Intro to CLI (Command Line Interface) - TGAC/knowledge_base GitHub Wiki
https://swcarpentry.github.io/shell-novice/
Why CLI?
The HPC has a limited graphical interface; getting the most out of the built-in functions will save you a great deal of frustration
man or -h/--help
...will bring up instructions for any that you’re trying to call.
Command line tutorials
http://linuxcommand.org/lc3_learning_the_shell.php
https://openclassrooms.com/en/courses/4614926-learn-the-command-line-in-terminal
Fundamentals
ls or ls
list information (what’s in this directory?)
cd or cd .. or cd
Change directory to path or up to parent directory or to ~/
mv
Move a file to another file
cp
Copy a file to another file
File manipulation
comm
Compare file 1 and 2, produce lines in common and unique to each file. File1 and 2 must be sorted first
sort
Sort file
head
Output first ten lines of a file (with -n option, output first n lines)
tail
Output last ten lines of a file (with -n option, output last n lines)
cat
Read /output contents of file
echo “”
Output text
Std I/O
<</>>
Ordinarily, standard input for a function come from/return to the terminal. You can redirect files in place of the terminal though.
echo “hello” >> hello
Chaining commands
Pipes! “|”
Redirects to a process, rather than a file. So you can chain together multiple commands.
cat seagate1.md5 | sed 's/[()]//g' | awk '{print $4,$2}' | sort > seagate_for_commm.md5
Shell variables
Say the magic $
One line magic
awk/sed/grep
for loops -
for/if/else/array loop structures
command editors
(vi/vim, emacs, nano)
shell tips & tricks
alias', .bash_rc, .bash_history, env’s