Professional Documents
Culture Documents
TOPIC
A. LINUX INSTALLATION
B. MANAGING CLI COMMANDS
1. cd command:
cd /home/user/Documents: Change directory to "/home/user/Documents".
cd ..: Move up one level in the directory structure.
cd /: Change to the root directory.
2. ls command:
ls: List files and directories in the current directory.
ls -l: List files in long format with detailed information.
ls -a: List all files, including hidden ones.
3. whoami:
whoami: Display the username of the current user.
sudo whoami: Display the username with superuser privileges.
whoami && id: Display both the username and user ID.
4. who:
who: Display information about users currently logged in.
who -q: Display only the number of logged-in users.
who -a: Display information about all users, including system processes.
5. w:
w: Display information about currently logged-in users and their activities.
w -h: Display a shorter format without header information.
w -u username: Display information for a specific user.
6. pwd:
pwd: Print the current working directory.
pwd -P: Print the physical current working directory (resolved symlink).
pwd -L: Print the logical current working directory (unresolved symlink).
7. ip addr:
ip addr show: Show information about network interfaces.
ip addr add 192.168.1.2/24 dev eth0: Add an IP address to the eth0 interface.
ip addr del 192.168.1.2/24 dev eth0: Remove an IP address from the eth0
interface.
8. nmcli device status:
nmcli device status: Display the status of all network devices.
nmcli device show eth0: Show detailed information about the eth0 device.
nmcli device disconnect eth0: Disconnect the eth0 network device.
9. last:
last: Show a list of last logged in users.
last -n 5: Display the last 5 logins.
last -i: Display IP addresses along with login information.
10. lastb:
lastb: Display a list of failed login attempts.
lastb -n 3: Display the last 3 failed login attempts.
lastb -w: Display additional information about the failed login attempts.
11. top:
top: Display a dynamic view of system processes.
top -u username: Display processes for a specific user.
top -p PID: Display information about a specific process ID.
12. dmidecode:
dmidecode: Display information about the system's hardware components.
dmidecode -t memory: Show details about the system memory.
dmidecode -t processor: Display information about the processor.
13. netstat:
netstat: Display network connections, routing tables, interface statistics.
netstat -tuln: Show listening sockets for TCP and UDP.
netstat -r: Display the routing table.
14. df:
df: Display information about disk space usage.
df -h: Show disk space in human-readable format.
df -T: Display the filesystem type along with usage.
15. du:
du: Display disk usage of files and directories in the current directory.
du -h: Show disk usage in a human-readable format.
du -s /path/to/directory: Display total disk usage for a specific directory.
16. shutdown -r:
shutdown -r now: Shut down and restart the system immediately.
shutdown -r +5: Schedule a system restart in 5 minutes.
shutdown -c: Cancel a scheduled system shutdown.
17. hostname:
hostname: Display the system's hostname.
hostnamectl set-hostname new-hostname: Change the system's hostname.
hostname -I: Display the system's IP address.
18. history:
history: Display the command history of the current user.
history 10: Show the last 10 commands in the history.
!ls: Execute the last command that starts with "ls" from the history.
19. uptime:
uptime: Display how long the system has been running.
uptime -p: Show the uptime in a more human-readable format.
uptime -s: Display the system's last boot time.
20. last reboot:
last reboot: Show the system's reboot history.
last reboot -F: Display the reboot history with full date and time.
last reboot -n 5: Show the last 5 system reboots.
21. nslookup:
nslookup example.com: Perform a DNS lookup for the domain "example.com".
nslookup 192.168.1.1: Perform a reverse DNS lookup for the IP address.
nslookup -query=mx example.com: Display mail server information for a domain.
Which command
Type command