Fundamentals 6 min read

Master Essential Linux Commands: From Basics to Advanced Operations

This guide introduces the most commonly used Linux command‑line tools, covering basic commands such as pwd, ls, cd, mkdir, rm, cp, mv and advanced utilities like grep, ps, top, tar, wget, curl, ssh, and scp, with examples and usage tips.

Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Master Essential Linux Commands: From Basics to Advanced Operations

Basic Commands

1. pwd

The pwd command displays the current working directory.

$ pwd
/home/user

2. ls

The ls command lists files and directories in the current location.

$ ls
Desktop Documents Downloads Music Pictures Public Videos

Use ls -l for a detailed list and ls -a to show hidden files.

3. cd

The cd command changes the current directory.

$ cd Documents
$ pwd
/home/user/Documents

Use cd .. to move up one level.

4. mkdir

The mkdir command creates a new directory.

$ mkdir myfolder

5. rm

The rm command removes files or directories.

$ rm myfile.txt
$ rm -r myfolder

6. cp

The cp command copies files or directories. $ cp myfile.txt myfolder/ Use the -r option to copy entire directories.

7. mv

The mv command moves or renames files and directories.

$ mv myfile.txt newfile.txt
$ mv myfolder/ ~/Documents/

Advanced Commands

1. grep

The grep command searches for a pattern within files and prints matching lines. $ grep "hello" myfile.txt Options: -i ignores case, -n shows line numbers.

2. ps

The ps command lists currently running processes.

$ ps
PID   TTY   TIME   CMD
1234  pts/0 00:00:01 bash
5678  pts/0 00:00:00 ps

Use ps aux for a detailed view of all processes.

3. top

The top command provides a real‑time view of system processes, CPU, and memory usage. $ top Press q to exit.

4. tar

The tar command creates and extracts archive files.

$ tar -cvf myfiles.tar myfile.txt myfolder/
$ tar -xvf myfiles.tar

Add the -z option to compress with gzip.

5. wget

The wget command downloads files from the web.

$ wget http://example.com/myfile.txt

6. curl

The curl command also downloads files and supports many protocols.

$ curl http://example.com/myfile.txt -o myfile.txt

Use -O to save with the remote filename, or -L to follow redirects.

7. ssh

The ssh command connects to a remote server to run commands.

$ ssh [email protected]
$ ssh [email protected] "ls -l"

Options: -p specifies a port, -i specifies an identity file.

8. scp

The scp command securely copies files between local and remote hosts.

$ scp myfile.txt [email protected]:/home/user/

Use -r to copy directories recursively and -P to set a custom port.

LinuxshellCommand LineUnixSystem Administration
Full-Stack DevOps & Kubernetes
Written by

Full-Stack DevOps & Kubernetes

Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.