pwd to know in which directory you
are.ls to read the file and directory contents.cd to go back to your home. | command | result |
|---|---|
| → or ← | Use the arrows to change the prompt position |
| ↑ or ↓ | Navigate in the commands you already wrote |
ctrl + r |
Search in the history of commands |
history |
Print to the screen the last x command lines |
Generally, the errors in the terminal are clear and helpful. If you don’t understand them:
my.name@cluster-i2bc:~$ ls coursBash
ls: cannot access 'coursBash': No such file or directoryHere ls can’t find any directory or file with this name
:
pwd or use
find to search in file systemmy.name@cluster-i2bc:~$ ls --alls
ls: unrecognized option '--alls'
Try 'ls --help' for more information.ls --help or man lsls --versionmy.name@cluster-i2bc:~$ ls-l
-bash: ls-l: command not foundThe bash terminal is looking for the command ls-l that
it can’t find:
module,
conda…my.name@cluster-i2bc:~$ rm diff-counts.tsv.gz
rm: remove write-protected regular file 'diff-counts.tsv.gz'? y
rm: cannot remove 'diff-counts.tsv.gz': Permission deniedI want to remove a file but bash is not allowing me to do this:
ls -lwhoami associated with
ls -lI want to know if my command ended correctly, is that possible? Yes
with $?
my.name@cluster-i2bc:~$ ls -l
total 116
-rw-r--r-- 1 root root 14932 Jan 18 2018 diff-counts.tsv.gz
my.name@cluster-i2bc:~$ echo $?
0
my.name@cluster-i2bc:~$ ls-l
-bash: ls-l: command not found
my.name@cluster-i2bc:~$ echo $?
127When the command executes correctly, bash returns an error value of 0 (=no error), but when an error occurs the value is different from 0 (in the exemple, the value is 127).
~ or | on MAC~ = option + N or
Alt + N
| = Alt + Shift +
L