Useful shell commands - to make life easier

Viewing files in the terminal

ls -G : list contents of current folder using different colors for files/folders

cat : concatenate file and print file to standard output

less : loads quickly, it allows you to scroll up and down within the file. It shows the top of the file without waiting for the entire file to load, it is espically useful for peaking into long files. Press 'q' to exit.

more : more is similar to less. Press 'q' to exit.

head : Used to print the first N lines of a file. It accepts N as input and the default value of N is 10.

tail : Used to print the last N-1 lines of a file. It accepts N as input and the default value of N is 10.

Redirecting output with '>' and '>>'

>>

: append rather than overwrite to output file

Piping standard output with '|'

File and directory manipulation commands

touch : Used to create or update a file.

Here are some steps to enable your virtual environments in Jupyter notebook. You may be able to skip step 1, and go directly to step 2.

STEP 1: in conda env terminal, ipython kernel install —user —name=.venv (or name of your environment). STEP 2: in conda env, conda install nb_conda_kernels

A summary of usefull control keys when reading man pages.

Key Behaviour

q: Quit and get back to the terminal

Space bar or F: Move forward one page

D: Move forward half a page

B: Move backwards one page

U: Move backwards half a page

Remove directory from remote repository after adding them to .gitignore

git rm -r --cached some-directory

git commit -m 'Remove the now ignored directory "some-directory"'

git push origin master

List of other useful commands

Useful references

Tags: shell commands, linux