Skip to content

Basic Unix Command Guide

swarbred edited this page Apr 24, 2026 · 4 revisions

Basic Unix Command Guide for Workshop Participants

This short guide introduces a few essential Unix commands to help you navigate and work in the terminal during the workshop. You do not need to memorise everything here — just refer back when needed.


1. Where am I?

pwd

Prints your current working directory.


2. Listing files

ls

Shows files and folders in the current directory.

Useful options:

ls -ltr   # long format, sorted with the latest date modified last # Note l is an alias for this in the workshop
ls -ltrh    # human-readable sizes

3. Changing directory

cd folder_name

Move into a folder.

cd ..

Move up one level.

cd ~

Go to your home directory.


4. Creating directories

mkdir new_folder

Create a new folder.

mkdir -p path/to/folder

Create nested folders if they do not exist.


5. Copying files

cp file.txt copy.txt
cp -r folder1 folder2

Copy directories recursively.


6. Moving and renaming

mv file.txt newname.txt
mv file.txt folder/

7. Removing files

rm file.txt
rm -r folder

⚠️ Be careful: deletion is permanent.


8. Viewing files

cat file.txt
less file.txt

Use q to exit less.


9. Searching

grep "pattern" file.txt

Search for text in a file.


10. Wildcards

ls *.txt

Matches all .txt files.


11. Command history

history

Use arrow keys ↑ ↓ to navigate previous commands.


12. Useful shortcuts

  • Ctrl + C → stop a running command
  • Ctrl + L → clear screen
  • Tab → autocomplete

13. Getting help

man ls

Shows manual pages.


Further learning

These external resources provide excellent beginner-friendly tutorials:


This guide covers the basics you need for the workshop. If something behaves unexpectedly, check your current directory with pwd and list files with ls.

Clone this wiki locally