cd– Change directorymkdir– Create a new directoryls– List directory contentstouch– Create an empty filepwd– Print current working directoryrm– Remove files or directoriescp– Copy files or directoriesmv– Move or rename files or directories
ps -ef– List all running processestop– Display real-time CPU and memory usagehtop– Interactive and visual process viewerfree– Show memory usage statisticsnproc– Show number of available CPU coreskill– Terminate a process by PIDkillall– Terminate all processes by name
grep– Search for lines matching a patternawk– Pattern scanning and text processing toolsed– Stream editor for filtering and transforming text|– Pipe: send output of one command as input to anothercat– Display file contentsecho– Print text to the terminalvi– Open the Vi text editornano– Simple and beginner-friendly text editor
chmod– Change file permissions (read/write/execute)chown– Change file owner or groupusermod– Modify user account (e.g., add to a group)passwd– Change user password
ping– Check connectivity to a hostcurl– Transfer data from or to a serverwget– Download files from the webifconfig– Show network interfaces (deprecated, but still used)ip a– Show IP addresses (modern alternative toifconfig)netstat– Display network connections (can be replaced byss)ss– Display detailed socket statistics
apt update– Update package listsapt upgrade– Upgrade installed packagesapt install <package>– Install a packageapt remove <package>– Remove a package
df -h– Show disk space usagedu -sh <folder>– Show disk usage of a folderuname -a– Show system informationhistory– Show command historyclear– Clear the terminal screenman <command>– Show manual page for a command \
set -x– Enable debug mode: print each command before executionset -e– Exit immediately if any command failsset -o pipefail– Return the exit code of the leftmost failing command in a pipeline
hash -r- Reset the shell Cache
| File Path | Description |
|---|---|
/etc/passwd |
Stores user account information |
/etc/shadow |
Stores user passwords and password aging data |
/etc/group |
Stores group information |
/etc/sudoers |
Defines users/groups allowed to run sudo |
-
View user info:
grep -i ^bob /etc/passwd
Example Output:
bob:x:1002:1002::/home/bob:/bin/shUSERNAME:PASSWORD:UID:GID:GECOS:HOMEDIR:SHELL -
Change password:
passwd # For current user passwd <username> # For specific user
-
Delete a user:
userdel <username>
-
View password entry:
grep -i ^bob /etc/shadow
Example Output:
bob:$6$...:18188:0:99999:7:::USERNAME:PASSWORD:LASTCHANGE:MINAGE:MAXAGE:WARN:INACTIVE:EXPDATE
-
Add a group:
groupadd <groupname>
-
Delete a group:
groupdel <groupname>
-
View user's group memberships:
grep -i ^bob /etc/group
GROUPNAME:PASSWORD:GID:MEMBERS