1. File and Directory Management
Command | Description |
ls | Lists files and directories in the current directory. |
pwd | Prints the current working directory. |
cd | Changes the current directory. |
mkdir <directory> | Creates a new directory. |
rm <file> | Removes a file. |
rm -r <directory> | Removes a directory and its contents. |
cp <source> <destination> | Copies files or directories. |
mv <source> <destination> | Moves or renames files or directories. |
touch <file> | Creates an empty file. |
find <path> -name <filename> | Searches for files by name. |
|
2. File Viewing and Editing
Command | Description |
cat <file> | Displays the contents of a file. |
less <file> | Displays file contents one page at a time. |
more <file> | Displays file contents one screen at a time. |
head <file> | Displays the first 10 lines of a file. |
tail <file> | Displays the last 10 lines of a file. |
nano <file> | Opens a file in the nano text editor. |
vi <file> | Opens a file in the vi editor. |
|
3. File Permissions
Command | Description |
chmod <permissions> <file> | Changes file permissions. |
chown <owner>:<group> <file> | Changes file owner and group. |
ls -l | Lists files with their permissions and ownership. |
|
4. System Information
Command | Description |
uname -a | Displays system information. |
hostname | Displays the system's hostname. |
uptime | Shows how long the system has been running. |
whoami | Displays the current user. |
df -h | Shows disk space usage. |
free -h | Displays memory usage. |
|
5. Process Management
Command | Description |
ps | Lists running processes. |
top | Displays system tasks and resource usage. |
kill <PID> | Terminates a process by its Process ID (PID). |
killall <name> | Terminates all processes by name. |
|
6. Networking
Command | Description |
ping <host> | Sends ICMP packets to test network connectivity. |
ifconfig | Displays network interface information. |
ip a | Displays IP addresses and interfaces. |
netstat -tuln | Lists open ports and their listening services. |
curl <URL> | Fetches content from a URL.
|
|
7. Package Management (Centos/Debian/Ubuntu)
Command | Description |
yum update | Updates the package list(Centos). |
yum install <package> | Installs a package(Centos). |
yum remove <package> | Removes a package(Centos). |
apt update | Updates the package list(Debian/Ubuntu). |
apt install <package> | Installs a package(Debian/Ubuntu). |
apt remove <package> | Remove a package(Debian/Ubuntu). |
|
8. User Management
Command | Description |
adduser <username> | Creates a new user. |
passwd <username> | Changes a user's password. |
who | Lists logged-in users. |
su <username> | Switches to another user account. |
|
9. Archiving and Compression
Command | Description |
tar -cvf archive.tar <files> | Archives files. |
tar -xvf archive.tar | Extracts an archive. |
gzip <files> | Compresses a file using gzip. |
gunzip <file.gz> | Decompresses a gzip file. |
|
10. System Shutdown and Reboot
Command | Description |
shutdown now
OR
init 0 | Shuts down the system immediately. |
reboot
OR
init 6 | Reboots the system. |
|