Commands ยท ~7 min read

30 Essential Linux Commands for Beginners

The terminal looks intimidating, but you only need a small core set to feel at home. These thirty commands cover the vast majority of everyday work. Open a terminal and try them as you read.

Getting around

pwd            # print working directory โ€” where am I?
ls -lah        # list files, long format, human sizes, incl. hidden
cd /etc        # change directory
cd ~           # go to your home folder
cd ..          # go up one level

ls, cd and pwd are the three you'll use most. The -lah flags on ls are worth memorizing.

Working with files & folders

touch notes.txt        # create an empty file
mkdir projects         # make a directory
cp file.txt backup.txt # copy
mv old.txt new.txt     # move or rename
rm file.txt            # delete a file (no undo!)
rm -r folder/          # delete a folder and its contents
Careful with rm. There's no recycle bin. Double-check the path before you hit Enter, and never run rm -rf on a path you don't fully understand.

Reading files

cat file.txt       # dump a whole file
less file.txt      # scroll a file (q to quit)
head -n 20 file    # first 20 lines
tail -n 20 file    # last 20 lines
tail -f log.txt    # follow a log live

Finding things

find . -name "*.pdf"     # find PDFs under the current folder
grep "error" log.txt     # find lines containing "error"
grep -ri "todo" .        # recursive, case-insensitive search
which python3            # where is this program installed?

Permissions & ownership

chmod +x script.sh       # make a script executable
chmod 644 file.txt       # standard read/write for owner
chown user:user file     # change ownership
sudo command             # run a command as administrator

sudo ("superuser do") is how you run admin tasks. Use it deliberately โ€” it can change anything on the system.

Installing software

# Debian / Ubuntu / Mint
sudo apt update
sudo apt install vlc

# Fedora
sudo dnf install vlc

Your package manager is the safe, official way to install apps โ€” far better than downloading random installers from the web.

Processes & the system

top            # live view of running processes (q to quit)
htop           # nicer version, if installed
df -h          # disk space, human-readable
free -h        # memory usage
kill 1234      # stop a process by its ID
ps aux         # list all running processes

The two commands that save you

man ls         # the manual for any command
ls --help      # quick help for most commands

When you forget a flag โ€” and you will โ€” man and --help are always there. Learning to read them is the single most useful Linux skill.