Linux Commands You Should Master
Tags: linux, terminal, cli, unix
Published: 2024-07-13 17:15:20

---
title: Linux Commands You Should Master
published: true
description:
tags: linux,terminal,cli,unix
cover_image: https://www.redhat.com/sysadmin/sites/default/files/styles/full/public/2020-02/blur-bright-business-codes-207580.jpg?itok=eUyGgeea
# Use a ratio of 100:42 for best results.
# published_at: 2024-07-13 16:58 +0000
---

Linux commands form the backbone of navigating and managing a Linux system efficiently through the terminal. Whether you're a beginner or an experienced user, mastering these commands will greatly enhance your productivity and control over your system. In this article, here are the top Linux commands that every user should master for effective terminal usage

Navigation and File Management

### cd: Change directory

```sh
  cd directory_name
```

### ls: List directory contents

```bash
ls options directory_path
```

### pwd: Print working directory

```bash
pwd
```

### cp: Copy files and directories

```bash
cp source_file destination_file
```

### mv: Move (rename) files and directories

```bash
mv source destination
```

### rm: Remove files and directories

```bash
rm file_name
```

### mkdir: Make directories

```bash
mkdir directory_name
```

### rmdir: Remove empty directories

```bash
rmdir directory_name
```

### cat: Concatenate and display files

```bash
cat file_name
```

### less/more: View file contents interactively (one screen at a time)

```bash
less file_name
more file_name
```

### head/tail: View the beginning or end of a file

```bash
head file_name
tail file_name
```

### grep: Search for patterns in files

```bash
grep pattern file_name
```

### find: Search for files in a directory hierarchy

```bash
find directory_path options
```


### ln: Create links between files

```bash
ln -s target_file link_name
```

### chmod: Change file permissions

```bash
chmod permissions file_name
```

### chown: Change file owner and group

```bash
chown owner:group file_name
```





## Process Management

### ps: Display information about active processes

```bash
ps
```

###  kill: Terminate processes

```bash
kill process_id
```

###  top/htop: Display system processes in real-time

```bash
top
htop
```



## System Information

### df: Display disk space usage

```bash
df options
```

###  du: Estimate file space usage

```bash
du options file_name
```

### free: Display amount of free and used memory in the system

```bash
free
```

### uname: Print system information

```bash
uname -a
```

### uptime: Show how long the system has been running

```bash
uptime
```



## Network Management

### ping: Check the connectivity to a server or network device

```bash
ping hostname_or_ip
```

### ifconfig/ip: Display and configure network interfaces

```bash
ip addr show
```

### netstat: Print network connections, routing tables, interface statistics, etc.

```bash
netstat options
```

### wget/curl: Download files from the internet

```bash
wget URL
curl -O URL
```



## System Administration

### sudo: Execute a command as the superuser (root)

```bash
sudo command
```
### shutdown/reboot: Shutdown or reboot the system

```bash
shutdown options
reboot
```

### service/systemctl: Control system services (systemd-based systems)

```bash
systemctl start|stop|restart service_name
```

### journalctl: Query and display system logs

```bash
journalctl options
```

### passwd: Change user password

```bash
passwd
```

## Text Processing

### awk: A versatile programming language for pattern scanning and processing

```bash
awk 'pattern { action }' file
```

### sed: Stream editor for filtering and transforming text

```bash
sed 's/search/replace/g' file
```

### cut: Remove sections from each line of files

```bash
cut options file
```

### sort: Sort lines of text files

```bash
sort options file
```

### uniq: Report or omit repeated lines

```bash
uniq options file
```

### wc: Print newline, word, and byte counts for each file

```bash
wc options file
```

## Compression and Archiving

### tar: Archive files and directories

```bash
tar options archive_name files
```

### gzip/gunzip: Compress or decompress files

```bash
gzip file
gunzip file.gz
```

### bzip2/bunzip2: Another compression utility

```bash
bzip2 file
bunzip2 file.bz2
```



## Miscellaneous

### echo: Display a line of text or variables

```bash
echo "Hello, world!"
```

### date: Display or set the system date and time

```bash
date
```

### watch: Execute a program periodically, showing output fullscreen

```bash
watch command
```

### alias: Create an alias for a command

```bash
alias short_name='command sequence'
```

### history: Display command history

```bash
history
```

### whoami: Display the current username

```bash
whoami
```

### touch: Change file timestamps or create empty files

```bash
touch file_name
```

### scp/rsync: Securely copy files between hosts

```bash
scp file user@host:destination
rsync options source destination
```

Mastering these Linux commands will empower you to efficiently manage files, processes, networks, and more directly from the terminal. Whether you're a system administrator, developer, or Linux enthusiast, these commands are indispensable tools for your daily workflow.

Happy Linux command-line hacking!