...
Table of Contents | ||
---|---|---|
|
...
01 Getting Started
01.01 Getting Started: What is Linux and Linux Distributions (distro)
What is an Operating System?
When you turn your device on, it boots up the operating system, which The main software on a system. It manages the communication/interface between your applications and the hardware it is running on.
As shown in the image above, an operating system (OS) functions between the computer’s hardware and the applications that run on the computer.
What is Linux?
Linux is an Operating Systems – similar to Windows, Mac OS, iOS, Android.
Linux is open-source – freely available – so you can download, modify and redistribute.
Due to this there are 10s of varieties of Linux Distributions (distros):
Debian
Ubuntu (based on Debian)
Fedora
Amazon Linux 2
Commercial: Red Hat (which we are using today)
Rocky Linux
There is a lot of commonality across these distros.
...
Desktop: Windows type Graphical User Interface (GUI) - mouse point and click.
Terminal: Program that opens a graphical window and runs a:
Shell which is a command interpreter that processes the typed commands.
Interface to the OS.
Provides a Command-Line Interface (CLI) – text-based input/output.
Different Shells share common commands, but syntax and behavior can be different.
...
02 Using the Terminal
What does a prompt look like?
General syntax of shell command.
Commands/options are case sensitive.
Getting Help:
Man pages (
man
)Options:
<command> --help
...
Open up Chrome
Navigate to: https://southpass.arcc.uwyo.edu/
Start Beartooth Shell Access
...
02.02 Download Slides
...
...
02.03 The Command-Line Prompt
...
02.04 Syntax of a Shell Command
...
02.05 Case Sensitive
Code Block |
---|
# Lists what is in the current location. [arcc-t05@blog1 ~]$ ls Desktop Documents Downloads # Throws an error. [arcc-t05@blog1 ~]$ LS -bash: LS: command not found Filename ≠ FiLeNaMe ≠ FILENAME |
Code Block |
---|
Filename ≠ FiLeNaMe ≠ FILENAME |
...
02.06 Getting Help: man
Code Block |
---|
[arcc-t05@blog1 ~]$ man ls LS(1) User Commands LS(1) NAME ls - list directory contents SYNOPSIS ls [OPTION]... [FILE]... DESCRIPTION List information about the FILEs (the current directory by default). Sort entries alpha‐ betically if none of -cftuvSUX nor --sort is specified. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. ... Manual page ls(1) line 1 (press h for help or q to quit) |
...
Code Block |
---|
[arcc-t05@blog1 ~]$ ls Desktop Documents Downloads [arcc-t05@blog1 ~]$ ls -al total 76 drwxr-x--- 8 arcc-t05 arcc-t05 4096 Oct 3 13:57 . drwxr-xr-x 925 root root 32768 Sep 27 16:21 .. -rw------- 1 arcc-t05 arcc-t05 212 Sep 12 15:44 .bash_history -rw-r--r-- 1 arcc-t05 arcc-t05 18 Aug 10 17:00 .bash_logout -rw-r--r-- 1 arcc-t05 arcc-t05 141 Aug 10 17:00 .bash_profile -rw-r--r-- 1 arcc-t05 arcc-t05 376 Aug 10 17:00 .bashrc drwx------ 3 arcc-t05 arcc-t05 4096 Sep 12 11:36 .config drwxr-xr-x 2 arcc-t05 arcc-t05 4096 Aug 10 17:00 Desktop drwxr-xr-x 2 arcc-t05 arcc-t05 4096 Aug 10 17:00 Documents |
...
02.12 12a Answers
2: How can you find out what the –al
options do?
Use
man ls
orls --help
-a, --all do not ignore entries starting with .
-l use a long listing format
Options are also case sensitive:
Code Block [arcc-t05@blog1 ~]$ ls -A .bash_history .bash_profile .config Documents .emacs .kshrc .mozilla .zshrc .bash_logout .bashrc Desktop Downloads .esd_auth .lesshst .sshWhat does the pwd command do?
...
02.12b Answers
3: What does the pwd
command do?
...
Steps through the previous commands you’ve typed.
...
03 File System
What the file system is, and a typical organization / hierarchy.
Some high-level comparison to that of Windows.
Absolute vs relative paths.
Commands:
pwd
,cd
,ls
,mv
,cp
,mkdir
,rmdir
,rm
History:
history
File Ownership and Permissions.
...
Code Block |
---|
# Reset: Type the following: [arcc-t05@blog1 ???]$ cd [arcc-t05@blog1 ~]$ # The ~ “tilda” character represents your home directory. [arcc-t05@blog1 ~]$ pwd /home/arcc-t05 |
...
03.13 13a cd: Change the shell working directory.
Code Block |
---|
# Reset: cd
# Move up one level.
# Move into the folder’s parent.
[arcc-t05@blog1 ~]$ cd ..
[arcc-t05@blog1 ~]$ pwd
/home
[arcc-t05@blog1 home]$ cd ..
[arcc-t05@blog1 /]$ pwd
/
# In the ‘root’ folder
[arcc-t05@blog1 /]$ ls
# Are we defining an absolute or relative path?
[arcc-t05@blog1 /]$ cd opt
[arcc-t05@blog1 opt]$ pwd
/opt |
...
03.13b cd: Change the shell working directory.
Code Block |
---|
[arcc-t05@blog1 opt]$ cd [arcc-t05@blog1 ~]$ # Are we defining an absolute or relative path? [arcc-t05@blog1 ~]$ cd /usr/include/asm [arcc-t05@blog1 asm]$ pwd /usr/include/asm [arcc-t05@blog1 asm]$ cd ../.. [arcc-t05@blog1 usr]$ pwd /usr [arcc-t05@blog1 usr]$ cd [arcc-t05@blog1 ~] |
...
...
03.14 ls: List information about the FILEs (cwd by default)
Code Block |
---|
# Reset: cd # List files in the user’s home folder. [arcc-t05@blog1 ~]$ ls # List long format that includes ownership and permission details. [arcc-t05@blog1 ~]$ ls -l # List all files, including hidden files and folders start with “.”. [arcc-t05@blog1 ~]$ ls –a # Notice how ‘short-name’ options are grouped. # List all files with long format. [arcc-t05@blog1 ~]$ ls –al # List all files with long format, in reverse order. [arcc-t05@blog1 ~]$ ls –alr # List all files with long format, in reverse order, in human readable form. [arcc-t05@blog1 ~]$ ls –alrh |
...
03.15 15a mkdir: Create the DIRECTORY(ies), if they do not already exist.
Code Block |
---|
$ cd
[~]$ ls
Desktop Documents Downloads
[~]$ mkdir folder01
[~]$ ls
Desktop Documents Downloads folder01
[~]$ mkdir folder01
mkdir: cannot create directory ‘folder01’: File exists
[~]$ cd folder01/
[folder01]$ pwd
/home/arcc-t05/folder01 |
...
03.15b mkdir: Create the DIRECTORY(ies), if they do not already exist.
Code Block |
---|
[folder01]$ mkdir folder02
[folder01]$ ls
folder02
[folder01]$ cd folder02/
[folder02]$ pwd
/home/arcc-t05/folder01/folder02
[folder02]$ cd ../..
[~]$ pwd
/home/arcc-t05 |
...
...
03.16 16a mv: Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY
Code Block |
---|
$ cd
# Create an empty file.
[~]$ touch myfil.txt
[~]$ ls
Desktop Documents Downloads folder01 myfil.txt
# Rename the file ‘myfil.txt’ to ‘myfile.txt’:
[~]$ mv myfil.txt myfile.txt
[~]$ ls
Desktop Documents Downloads folder01 myfile.txt
|
...
03.16b mv: Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY
Code Block |
---|
# Move the file ‘myfile.txt’ into the directory ‘folder01’ [~]$ mv myfile.txt folder01/ [~]$ ls Desktop Documents Downloads folder01 # We can ‘ls’ what is in a relative folder. [~]$ ls folder01/ folder02 myfile.txt |
...
Code Block |
---|
[~]$ ls Desktop Documents Downloads folder01 folder03 myfile02b.txt myfile02.txt [~]$ mkdir folder04 [~]$ ls Desktop Documents Downloads folder01 folder03 folder04 myfile02b.txt myfile02.txt # Can remove folder04 since it is empty. [~]$ rmdir folder04 [~]$ ls Desktop Documents Downloads folder01 folder03 myfile02b.txt myfile02.txt [~]$ rmdir folder03/ rmdir: failed to remove 'folder03/': Directory not empty |
...
03.20 20a rm: Remove (unlink) the FILE(s).
Code Block |
---|
[~]$ cd
[~]$ cd folder03
[folder03]$ ls
folder02 myfile02b.txt myfile.txt
[folder03]$ ls folder02/
[folder03]$
# ‘folder02’ is empty.
[folder03]$ rmdir folder02/
[folder03]$ ls
myfile02b.txt myfile.txt
[folder03]$ rm myfile.txt
[folder03]$ ls
myfile02b.txt
[folder03]$ rm myfile02b.txt |
...
...
03.20b rm: Remove (unlink) the FILE(s).
Code Block |
---|
[folder03]$ ls
[folder03]$
# ‘folder03’ is now empty.
[folder03]$ cd ..
[~]$ rmdir folder03/
[~]$ ls
Desktop Documents Downloads folder01 myfile02b.txt myfile02.txt
# This has taken a lot of individual steps.
# Can we do this quicker? |
...
...
03.21 rm: folders and file(s)
...
Code Block |
---|
# Can you cd into the /opt folder? [arcc-t05@blog1 ~]$ cd /opt [arcc-t05@blog1 opt]$ # Can you cd into the /root folder? [arcc-t05@blog1 ~]$ cd /root -bash: cd: /root: Permission denied # Justify your answer. [arcc-t05@blog1 ~]$ ls -l / ... # “other” has read permissions drwxr-xr-x. 5 root root 43 Jun 26 11:47 opt ... # No permission set for other read permissions dr-xr-x---. 17 root root 4096 Oct 4 12:58 root |
...
04 Next Steps, Summary
...
04.01 Next Steps, Suggestions
Next Steps on using Linux:
Practicing using Linux online.
Dual boot a Windows machine with Linux.
Run a container image.
UW Researcher? Create a project on the Beartooth cluster with your PI.
...
04.02 Further Trainings: UWYO LinkedIn
...
Introduction to Linux
Learning Linux Command Line
Linux: Files and Permissions
Linux: Over and Installation
Learning Linux Shell Scripting
...
04.03 Request an Account with ARCC
...
...
04.04 Summary
In this workshop we have:
Introduced the basics of the Linux OS using a command-line interface.
Taken a look at the hierarchical file system and how to navigate around it.
Introduced the basics of file/folder permissions and ownership.
How to view, create, update and delete files and folders.
...
04.05 The End
Any questions?
Thank you.