Skip to content
SimLab Academy
← All Resources

Linux Command Reference

The essential shell commands you'll use throughout the course.

Navigation

CommandWhat it does
pwdPrint the current directory
cd my_project/Change into a directory
cd ..Go up one directory
lsList files
ls -laList files, including hidden ones, with details

Files and directories

CommandWhat it does
mkdir simulation_01Create a directory
touch notes.txtCreate an empty file
cp topol.top backup/Copy a file
mv old.gro new.groRename or move a file
rm file.logDelete a file (no undo - be careful)
rm -r old_run/Delete a directory and its contents

Viewing files

CommandWhat it does
cat file.mdpPrint an entire file to the screen
less file.logScroll through a large file (q to quit)
head -n 20 file.logShow the first 20 lines
tail -n 20 file.logShow the last 20 lines
tail -f md.logWatch a file update live as a run writes to it

Searching

CommandWhat it does
grep "error" md.logFind lines containing "error"
grep -i "warning" md.logSame, but case-insensitive
grep -r "TODO" .Search recursively through every file in a folder

Permissions and processes

CommandWhat it does
chmod +x script.shMake a script executable
topLive view of running processes and CPU/memory use
ps auxList all running processes
kill 12345Stop a process by its ID

Redirection and pipes

SymbolWhat it does
command > file.txtWrite output to a file (overwrite)
command >> file.txtAppend output to a file
command1 | command2Send the output of one command into another

Example: gmx mdrun -deffnm em > run.log 2>&1 runs a simulation and saves all its output (including errors) to run.log.

Archives

CommandWhat it does
tar -czvf archive.tar.gz folder/Compress a folder into a .tar.gz archive
tar -xzvf archive.tar.gzExtract a .tar.gz archive

A note on case-sensitivity

Linux paths are case-sensitive. Topol.top and topol.top are two different files - a very common source of confusing "file not found" errors when following along with a tutorial.