File System Navigation
pwd: Prints the current working directory.
ls: Lists files and directories in the current directory.
o ls -l: Detailed listing with permissions, ownership, etc.
o ls -a: Includes hidden files.
cd: Changes the current directory.
o cd ..: Goes up one directory.
o cd /path/to/directory: Goes to a specific directory.
File Operations
cp: Copies files or directories.
o cp file1 file2: Copies file1 to file2.
o cp -r dir1 dir2: Recursively copies directories.
mv: Moves or renames files or directories.
o mv oldname newname: Renames a file.
o mv file1 /path/to/destination: Moves a file to another directory.
rm: Removes files or directories.
o rm file: Removes a file.
o rm -r dir: Removes a directory and its contents.
o rm -f file: Forcibly removes a file without asking.
touch: Creates an empty file or updates the timestamp of an existing
file.
File Permissions
chmod: Changes file permissions.
o chmod 755 file: Sets read, write, execute permissions for owner,
and read-execute for others.
o chmod +x file: Adds execute permission.
chown: Changes ownership of a file.
o chown user:group file: Changes the file’s owner and group.
chgrp: Changes the group ownership of a file.
Process Management
ps: Displays information about active processes.
o ps aux: Lists all processes with detailed information.
top: Displays a dynamic, real-time view of system processes.
kill: Sends a signal to terminate a process.
o kill pid: Terminates a process by PID (Process ID).
o kill -9 pid: Forcefully terminates a process.
bg: Resumes a paused job in the background.
fg: Brings a background job to the foreground.
File Compression
gzip: Compresses files.
o gzip file: Compresses the file.
o gunzip file.gz: Decompresses the file.
System Monitoring and Information
df: Displays disk space usage.
o df -h: Shows human-readable sizes.
du: Displays disk usage for files and directories.
o du -sh *: Summarizes the size of each file and directory in the
current directory.
free: Displays memory usage.
o free -h: Shows human-readable memory sizes.
uptime: Shows system uptime and load averages.
Networking
ping: Tests network connectivity.
o ping google.com: Pings Google's servers.
ifconfig: Displays network interfaces and their configuration.
ip: Advanced tool for network management.
o ip addr show: Displays IP addresses.
o ip link set eth0 up: Brings a network interface up.
netstat: Shows network connections, routing tables, etc.
ssh: Securely connects to a remote machine.
o ssh user@hostname: Connect to a remote server.
scp: Securely copies files between hosts.
o scp file user@hostname:/path/to/destination: Copy a file to a
remote machine.
o sudo dnf remove package: Removes a package.
User Management
useradd: Adds a new user.
o sudo useradd username: Creates a new user.
passwd: Changes a user's password.
o sudo passwd username: Changes the password for a specific
user.
usermod: Modifies a user account.
o sudo usermod -aG group username: Adds a user to a group.
groupadd: Adds a new group.
o sudo groupadd groupname: Creates a new group.
Editing Files
nano: A simple terminal text editor.
o nano file: Opens the file in the nano editor.
vim or vi: A powerful terminal-based text editor.
o vim file: Opens the file in vim.
cat: Displays the contents of a file.
more: Views the contents of a file page by page.
less: Similar to more, but allows for backward navigation.
System Shutdown and Reboot
shutdown: Shuts down or reboots the system.
o sudo shutdown -h now: Immediately shuts down.
o sudo shutdown -r now: Immediately reboots.
reboot: Reboots the system.
Other Useful Commands
echo: Prints text or variables to the terminal.
o echo "Hello, World!": Prints the text.
man: Displays the manual page for a command.
o man ls: Shows the manual for the ls command.
history: Shows the history of previously executed commands.