...
02.04 Syntax of a Shell Command
...
02.05 Case Sensitive
|
|
...
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) |
...
02.07 Getting Help: <command --help>
Code Block |
---|
[arcc-t05@blog1 ~]$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically 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 ..
--author with -l, print the author of each file
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE with -l, scale sizes by SIZE when printing them;
e.g., '--block-size=M'; see SIZE format below
-B, --ignore-backups do not list implied entries ending with ~
|
...
02.08 Getting Help: Options
Typically, options can have a:
short-name: “
-a
”:Single letter following a single “
-
”
long-name: “
--all
”:More descriptive word after two dashes “
--
”
Short options can be grouped:
“
ls -a –l
” can be shortened to “ls –al
”
...
02.09 Single vs Multiple Lines
Code Block |
---|
[arcc-t05@blog1 ~]$ ls -al ~
[arcc-t05@blog1 ~]$ ls \
> -al \
> ~ |
...
02.10 Exercises
Questions:
Is there a difference between running
ls
versusls -al
?How can you find out what the
–al
options do?What does the
pwd
command do?From the command line, what happens if you press the up/down arrow keys?
...
02.11 Answers
Is there a difference between running
ls
versusls -al
?
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 Answers
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?
What does the
pwd
command do?
Use
man pwd
orpwd --help
pwd - print name of current/working directory
From the command line, what happens if you press the up/down arrow keys?
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.
...
03.01 Some high-level comparison to that of Windows.
| Windows | Linux |
Structure | Uses (data) drives C:, D:, E:… | Uses a tree hierarchy starting at “ Known as the root directory. |
|
|
|
Syntax | Uses the back slash: “\” | Uses the forward slash: “/” |
Home folder |
|
|
Application Install |
|
|
Folder and Filenames | Case insensitive: FoLdEr = FOLDER | Case sensitive: FoLdEr ≠ FOLDER |
|
| Wherever you are within the hierarchy is known as your current working directory (cwd) |
...
03.02 Linux Hierarchical Structure: Example
...
03.03 Absolute Path: /home/arcc-t05/
Path starts with a “/”
...
03.04 Absolute Path: /home/arcc-t05/workshop/projects/p01/etc/
...
03.05 Relative Path: workshop/projects/p01/etc/
Path does not start with a “/”
...
03.06 Relative Path: p01/etc/
...
03.07 Ex: Starting at / (root), what is the absolute path to the bits folder?
...
03.08 Ans: /usr/include/bits/
...
03.09 Ex: Starting in the home folder what is the relative path to the Jan folder?
...
03.10 Ans: arcc-t05/workshop/data/2023/Jan/
...
03.11a Commands: <command --help>
Command | Description | ||
pwd |
| ||
cd |
| ||
ls |
| ||
mkdir |
| ||
mv |
|
...
03.11b Commands: <command --help>
Command | Description | ||
cp |
| ||
rmdir |
| ||
rm |
|
...
03.12 pwd: Print the name of the current working directory.
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 cd: Change the shell working directory.
|
|
---|
...
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 mkdir: Create the DIRECTORY(ies), if they do not already exist.
|
|
---|
...
...
...
Headers and Sections
Each sections should start with a header of ‘Heading 1’. This helps to make sure that the Table of Contents operates like an agenda. Also it helps when we “advance a slide” it jumps to the top of the section. Each section should be limited in length to no more than 14 lines of straight text to ensure that when presenting it can be viewed as a “Slide”.
This is 14 lines. A.K.A. the End
...