Linux Command Line: A Practical First Week

The Linux command line looks strange when you first open it. There are no buttons, no file browser, and no obvious indication of what to click next.

The good news is that most everyday terminal work is built from a small set of commands. Once those become familiar, the rest starts to feel much less mysterious.

Start with where you are

The first useful question is simple: where am I?

pwd

pwd prints the current working directory. On a server, you might see /home/alex or /opt/app.

List the files around you with ls.

ls
ls -la

The -l option gives a detailed listing, while -a includes hidden files. Combining options is common in Linux.

Move around the filesystem

Use cd to change directories.

cd /var/log
cd ..
cd ~

.. means the parent directory and ~ normally means your home directory.

Absolute paths start from /. Relative paths start from your current directory.

That distinction becomes important when you write scripts. A script using /var/log/app.log does not care where it was started from.

Create and inspect files

You can create an empty file with touch.

touch notes.txt
ls -l notes.txt

For a quick look at text, use cat.

cat notes.txt

For larger files, less is safer because it does not dump everything into the terminal at once.

less /var/log/syslog

Press q to leave less.

Copy, move, and remove

The basic file operations are cp, mv, and rm.

cp notes.txt notes-backup.txt
mv notes-backup.txt archive.txt
rm archive.txt

Be careful with rm. There is normally no recycle bin involved.

A useful habit is to inspect a path before removing it.

pwd
ls -la

Only then run the destructive command.

Understand permissions

Every file has an owner, a group, and permission bits.

ls -l script.sh

A result such as -rwxr-xr-- can be read as owner permissions, group permissions, and permissions for everyone else.

The x bit means executable. Add it with chmod when you really intend a script to run directly.

chmod +x script.sh
./script.sh

Do not make everything executable just because it fixes a permission error. Permissions are part of the security model.

Use sudo deliberately

Administrative commands are usually run through sudo.

sudo systemctl restart nginx

If a command works only with sudo, understand why it needs elevated privileges instead of adding sudo automatically.

This is especially important when copying commands from documentation or forums.

Find things without guessing

The find command is useful when you know roughly what you are looking for.

find /var/log -type f -name '*.log'

For searching inside text files, grep is a classic tool.

grep -R "error" /var/log/myapp

Modern systems may also have rg installed. It is fast and convenient for source trees.

Look at running processes

ps provides a snapshot of processes.

ps aux

For an interactive view, try top.

top

If your distribution provides it, htop is another friendly option.

The important lesson is not memorizing every column. Learn to identify the process name, PID, CPU usage, and memory usage first.

Install software

Package management depends on the distribution. Debian and Ubuntu commonly use apt.

sudo apt update
sudo apt install curl

Updating package metadata is different from upgrading installed packages.

sudo apt upgrade

On Fedora and RHEL-family systems, dnf is the usual tool.

sudo dnf install curl

Do not mix package-management instructions between distributions without checking what your system actually uses.

Check basic system information

A few commands are useful on almost every server.

uname -a
cat /etc/os-release
free -h
df -h

These answer different questions: kernel details, distribution identity, memory usage, and filesystem capacity.

When asking for help, collecting this information first often saves several rounds of questions.

Build a safe habit

The terminal rewards curiosity, but it also rewards caution. Read a command before pressing Enter, especially when it contains sudo, rm, dd, redirects, or recursive options.

Start with commands that observe the system. Then move to commands that change one small thing.

That approach turns the command line from a collection of scary strings into a predictable toolbox.