Skip to content

Instantly share code, notes, and snippets.

@korenmiklos
Created February 21, 2019 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korenmiklos/e92c0f7250d3119c040f9e1b59917ef6 to your computer and use it in GitHub Desktop.
Save korenmiklos/e92c0f7250d3119c040f9e1b59917ef6 to your computer and use it in GitHub Desktop.
shell session

bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ 
bash-3.2$ clear
bash-3.2$ pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics

{: .output}

bash-3.2$ cd korenmiklos-open-trade-data-ba866eb/
bash-3.2$ ls

{: .bash}

CERDI		IMF		README.md	UN		download.sh

{: .output}

bash-3.2$ ls -F

{: .bash}

CERDI/		IMF/		README.md*	UN/		download.sh*

{: .output}

bash-3.2$ man ls

{: .bash}

49h

LS(1)                     BSD General Commands Manual                    LS(1)

NAME
     ls -- list directory contents

SYNOPSIS
     ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file ...]

DESCRIPTION
     For each operand that names a file of a type other than directory, ls displays its
     name as well as any requested, associated information.  For each operand that names a
     file of type directory, ls displays the names of files contained within that direc-
     tory, as well as any requested, associated information.

     If no operands are given, the contents of the current directory are displayed.  If
     more than one operand is given, non-directory operands are displayed first; directory
     and non-directory operands are sorted separately and in lexicographical order.

     The following options are available:

     -@      Display extended attribute keys and sizes in long (-l) output.

     -1      (The numeric digit ``one''.)  Force output to be one entry per line.  This is
             the default when output is not to a terminal.

     -A      List all entries except for . and ...  Always set for the super-user.

     -a      Include directory entries whose names begin with a dot (.).

     -B      Force printing of non-printable characters (as defined by ctype(3) and cur-
             rent locale settings) in file names as \xxx, where xxx is the numeric value
             of the character in octal.

     -b      As -B, but use C escape codes whenever possible.

     -C      Force multi-column output; this is the default when output is to a terminal.

     -c      Use time when file status was last changed for sorting (-t) or long printing
             (-l).
:
 ESCOB

:
 ESCOA


:
 ESCOA
<kbd>Tab</kbd>
:
 ESCOA
<kbd>Tab</kbd>
:
 ESCOB

:
 ESCOB
     -d      Directories are listed as plain files (not searched recursively).
:
 ESCOB

:
 ESCOB
     -e      Print the Access Control List (ACL) associated with the file, if present, in
:
 ESCOB
             long (-l) output.
:
 ESCOA
     ls -- list directory contents

:
 ESCOA
NAME

:
 ESCOA


:
 ESCOA
LS(1)                     BSD General Commands Manual                    LS(1)

:
 ESCOA


:
 ESCOA
<kbd>Tab</kbd>
:
 ESCOA
<kbd>Tab</kbd>
:
 ESCOA
<kbd>Tab</kbd>
:
�>49lbash-3.2$ la --help
bash: la: command not found

{: .output}

bash-3.2$ ls

{: .bash}

ls: illegal option -- -
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
basman ls
49h

LS(1)                     BSD General Commands Manual                    LS(1)

NAME
     ls -- list directory contents

SYNOPSIS
     ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file ...]

DESCRIPTION
     For each operand that names a file of a type other than directory, ls displays its
     name as well as any requested, associated information.  For each operand that names a
     file of type directory, ls displays the names of files contained within that direc-
     tory, as well as any requested, associated information.

     If no operands are given, the contents of the current directory are displayed.  If
     more than one operand is given, non-directory operands are displayed first; directory
     and non-directory operands are sorted separately and in lexicographical order.

     The following options are available:

     -@      Display extended attribute keys and sizes in long (-l) output.

     -1      (The numeric digit ``one''.)  Force output to be one entry per line.  This is
             the default when output is not to a terminal.

     -A      List all entries except for . and ...  Always set for the super-user.

     -a      Include directory entries whose names begin with a dot (.).

     -B      Force printing of non-printable characters (as defined by ctype(3) and cur-
             rent locale settings) in file names as \xxx, where xxx is the numeric value
             of the character in octal.

     -b      As -B, but use C escape codes whenever possible.

     -C      Force multi-column output; this is the default when output is to a terminal.

     -c      Use time when file status was last changed for sorting (-t) or long printing
             (-l).
:
 ESCOB

:
 ESCOB
     -d      Directories are listed as plain files (not searched recursively).
:
 ESCOB

:
 ESCOB
     -e      Print the Access Control List (ACL) associated with the file, if present, in
:
 ESCOB
             long (-l) output.
:
 ESCOB

:
 ESCOB
     -F      Display a slash (`/') immediately after each pathname that is a directory, an
:
 ESCOB
             asterisk (`*') after each that is executable, an at sign (`@') after each
:
 ESCOB
             symbolic link, an equals sign (`=') after each socket, a percent sign (`%')
:
 ESCOB
             after each whiteout, and a vertical bar (`|') after each that is a FIFO.
:
 ESCOB

:
 ESCOB
     -f      Output is not sorted.  This option turns on the -a option.
:
 ESCOB

:
�>49lbash-3.2$ ls -l
total 16
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 CERDI
drwxr-xr-x@ 4 koren  staff  128 Feb 21 09:22 IMF
-rwxr-xr-x@ 1 koren  staff  522 Feb 20 07:41 README.md
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 UN
-rwxr-xr-x@ 1 koren  staff  208 Feb 20 07:41 download.sh

{: .output}

bash-3.2$ ls -l -F

{: .bash}

total 16
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 CERDI/
drwxr-xr-x@ 4 koren  staff  128 Feb 21 09:22 IMF/
-rwxr-xr-x@ 1 koren  staff  522 Feb 20 07:41 README.md*
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 UN/
-rwxr-xr-x@ 1 koren  staff  208 Feb 20 07:41 download.sh*

{: .output}

bash-3.2$ ls h

{: .bash}

CERDI		IMF		README.md	UN		download.sh

{: .output}

bash-3.2$ <kbd>Tab</kbd>ls -lF

{: .bash}

total 16
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 CERDI/
drwxr-xr-x@ 4 koren  staff  128 Feb 21 09:22 IMF/
-rwxr-xr-x@ 1 koren  staff  522 Feb 20 07:41 README.md*
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 UN/
-rwxr-xr-x@ 1 koren  staff  208 Feb 20 07:41 download.sh*

{: .output}

bash-3.2$ cd IMF/
bash-3.2$ ls -l

{: .bash}

total 28896
-rwxr-xr-x@ 1 koren  staff  14359689 Feb 20 07:41 DOT_02-20-2019 15-34-49-99.csv
-rwxr-xr-x@ 1 koren  staff    430622 Feb 20 07:41 Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls Metadata_DOT_02-20-2019\ 15-34-49-99.csv 

{: .bash}

Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls -l 

{: .bash}

-rwxr-xr-x@ 1 koren  staff  430622 Feb 20 07:41 Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls -l Meta

{: .bash}

ls: Meta: No such file or directory

{: .output}

bash-3.2$ ls -l Meta*

{: .bash}

-rwxr-xr-x@ 1 koren  staff  430622 Feb 20 07:41 Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls

{: .bash}

DOT_02-20-2019 15-34-49-99.csv		Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ touch Meta.txt
bash-3.2$ ls

{: .bash}

DOT_02-20-2019 15-34-49-99.csv		Metadata_DOT_02-20-2019 15-34-49-99.csv
Meta.txt

{: .output}

bash-3.2$ ls Met<kbd>Tab</kb<kbd>Tab</kbd>eta<kbd>Tab</kbd>

{: .bash}

Meta.txt                                 Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls Metadata_DOT_02-20-2019\ 15-34-49-99.csv 

{: .bash}

Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls Me<kbd>Tab</kbd>ta<kbd>Tab</kbd>

{: .bash}

Meta.txt                                 Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls Meta.txt 

{: .bash}

Meta.txt

{: .output}

bash-3.2$ pw<kbd>Tab</kbd>

{: .bash}

pwd         pwd_mkdb    pwhich      pwhich5.18  pwpolicy    

{: .output}

bash-3.2$ pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb/IMF

{: .output}

bash-3.2$ cd ..
bash-3.2$ tree

{: .bash}

bash: tree: command not found

{: .output}

bash-3.2$ find .

{: .bash}

.
./UN
./UN/country-codes.csv
./CERDI
./CERDI/CERDI-seadistance.dta
./README.md
./IMF
./IMF/Meta.txt
./IMF/Metadata_DOT_02-20-2019 15-34-49-99.csv
./IMF/DOT_02-20-2019 15-34-49-99.csv
./download.sh

{: .output}

bash-3.2$ pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb

{: .output}

bash-3.2$ cd /
bash-3.2$ pwd

{: .bash}

/

{: .output}

bash-3.2$ ls

{: .bash}

Applications			cores				private
Library				dev				sbin
Network				etc				tmp
System				home				usr
Users				installer.failurerequests	var
Volumes				net
bin				opt

{: .output}

bash-3.2$ cd
bash-3.2$ pwd

{: .bash}

/Users/koren

{: .output}

bash-3.2$ cd .
bash-3.2$ cd ..
bash-3.2$ pwd

{: .bash}

/Users

{: .output}

bash-3.2$ cd ~
bash-3.2$ cd Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba8

{: .bash}

866eb/

{: .output}

bash-3.2$ pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb

{: .output}

bash-3.2$ cd IMF/
bash-3.2$ cd IMF

{: .bash}

bash: cd: IMF: No such file or directory

{: .output}

bash-3.2$ pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb/IMF

{: .output}

bash-3.2$ cd ..
bash-3.2$ cd IMF/
bash-3.2$ cd <kbd>Tab</kbd>I<kbd>Tab</kbd><kbd>Tab</kbd><kbd>Tab</<kbd>Tab</kbd>pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb/IMF

{: .output}

bash-3.2$ <kbd>Tab</kbd>ls ../../

{: .bash}

AUTHORS					aio.md
CITATION				assets
CODE_OF_CONDUCT.md			bin
CONTRIBUTING.md				code
LICENSE.md				css
Makefile				data
README.md				fig
_config.yml				files
_episodes				img
_episodes_rmd				index.md
_extras					korenmiklos-open-trade-data-ba866eb
_includes				reference.md
_layouts				screenlog.0
_site					setup.md

{: .output}

bash-3.2$ <kbd>Tab</kbd><kbd>Tab</kbd><kbd>Tab</kbd>cd ..
bash-3.2$ ls IMF/../UN

{: .bash}

country-codes.csv

{: .output}

bash-3.2$ <kbd>Tab</kbd><kbd>Tab</kbd><kbd>Tab</kbd><kbd>Tab</kbd>pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb

{: .output}

bash-3.2$ mkdir .my_hidden_directory
bash-3.2$ ls

{: .bash}

CERDI		IMF		README.md	UN		download.sh

{: .output}

bash-3.2$ ls -F

{: .bash}

CERDI/		IMF/		README.md*	UN/		download.sh*

{: .output}

bash-3.2$ ls -l

{: .bash}

total 16
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 CERDI
drwxr-xr-x@ 5 koren  staff  160 Feb 21 09:39 IMF
-rwxr-xr-x@ 1 koren  staff  522 Feb 20 07:41 README.md
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 UN
-rwxr-xr-x@ 1 koren  staff  208 Feb 20 07:41 download.sh

{: .output}

bash-3.2$ ls -a

{: .bash}

.			.my_hidden_directory	IMF			UN
..			CERDI			README.md		download.sh

{: .output}

bash-3.2$ ls -alF

{: .bash}

total 16
drwxr-xr-x@  8 koren  staff   256 Feb 21 09:52 ./
drwxr-xr-x@ 34 koren  staff  1088 Feb 21 09:22 ../
drwxr-xr-x@  2 koren  staff    64 Feb 21 09:52 .my_hidden_directory/
drwxr-xr-x@  3 koren  staff    96 Feb 21 09:22 CERDI/
drwxr-xr-x@  5 koren  staff   160 Feb 21 09:39 IMF/
-rwxr-xr-x@  1 koren  staff   522 Feb 20 07:41 README.md*
drwxr-xr-x@  3 koren  staff    96 Feb 21 09:22 UN/
-rwxr-xr-x@  1 koren  staff   208 Feb 20 07:41 download.sh*

{: .output}

bash-3.2$ ls -t

{: .bash}

IMF		UN		CERDI		README.md	download.sh

{: .output}

bash-3.2$ ls -l

{: .bash}

total 16
drwxr-xr-x@ 5 koren  staff  160 Feb 21 09:39 IMF
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 UN
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 CERDI
-rwxr-xr-x@ 1 koren  staff  522 Feb 20 07:41 README.md
-rwxr-xr-x@ 1 koren  staff  208 Feb 20 07:41 download.sh

{: .output}

bash-3.2$ ls -ltr

{: .bash}

total 16
-rwxr-xr-x@ 1 koren  staff  208 Feb 20 07:41 download.sh
-rwxr-xr-x@ 1 koren  staff  522 Feb 20 07:41 README.md
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 CERDI
drwxr-xr-x@ 3 koren  staff   96 Feb 21 09:22 UN
drwxr-xr-x@ 5 koren  staff  160 Feb 21 09:39 IMF

{: .output}

bash-3.2$ pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb

{: .output}

bash-3.2$ cd /Users/koren/Dropbox/
bash-3.2$ <kbd>Tab</kbd>cd teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb/
bash-3.2$ cd IMF/
bash-3.2$ pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb/IMF

{: .output}

bash-3.2$ cd ..
bash-3.2$ tree

{: .bash}

.
├── CERDI
│   └── CERDI-seadistance.dta
├── IMF
│   ├── DOT_02-20-2019\ 15-34-49-99.csv
│   ├── Meta.txt
│   └── Metadata_DOT_02-20-2019\ 15-34-49-99.csv
├── README.md
├── UN
│   └── country-codes.csv
└── download.sh

3 directories, 7 files

{: .output}

bash-3.2$ <kbd>Tab</kbd><kbd>Tab</kbd>pwd

{: .bash}

/Users/koren/Dropbox/teaching/courses/2019/carpentries/shell-economics/korenmiklos-open-trade-data-ba866eb

{: .output}

bash-3.2$ ls IMF/*.csv

{: .bash}

IMF/DOT_02-20-2019 15-34-49-99.csv		IMF/Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls -al 

{: .bash}

-rwxr-xr-x@ 1 koren  staff  14359689 Feb 20 07:41 IMF/DOT_02-20-2019 15-34-49-99.csv
-rwxr-xr-x@ 1 koren  staff    430622 Feb 20 07:41 IMF/Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls -al IMF/*

{: .bash}

-rwxr-xr-x@ 1 koren  staff  14359689 Feb 20 07:41 IMF/DOT_02-20-2019 15-34-49-99.csv
-rwxr-xr-x@ 1 koren  staff    430622 Feb 20 07:41 IMF/Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls -al IMF/Meta*

{: .bash}

-rw-r--r--@ 1 koren  staff       0 Feb 21 09:39 IMF/Meta.txt
-rwxr-xr-x@ 1 koren  staff  430622 Feb 20 07:41 IMF/Metadata_DOT_02-20-2019 15-34-49-99.csv

{: .output}

bash-3.2$ ls -al IMF/Meta.tx?

{: .bash}

-rw-r--r--@ 1 koren  staff  0 Feb 21 09:39 IMF/Meta.txt

{: .output}

bash-3.2$ <kbd>Tab</kbd>ls -al IMF/Meta?

{: .bash}

ls: IMF/Meta?: No such file or directory

{: .output}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment