๐ File and Directory Operations#
# Lists files and directories
ls
# Lists files with details
ls -l
# Changes directory
cd <directory_name>
# Creates a new directory
mkdir <directory_name>
# Removes a file
rm <file_name>
# Removes a directory and its contents recursively
rm -r <directory_name>
# Copies a file or directory
cp <source> <destination>
# Moves or renames a file or directory
mv <source> <destination>
# Displays system information
uname -a
# Shows disk space usage
df -h
# Shows memory usage
free -h
# Displays running processes
top
๐ ๏ธ Package Management (APT)#
# Updates the package list
sudo apt update
# Upgrades installed packages to the latest versions
sudo apt upgrade
# Installs a package
sudo apt install <package_name>
# Removes a package
sudo apt remove <package_name>
# Removes unnecessary packages
sudo apt autoremove
๐ง User and Permissions#
# Switches to another user
su <username>
# Adds a new user
sudo adduser <username>
# Changes file permissions
chmod <permissions> <file_name>
# Changes file ownership
chown <user>:<group> <file_name>
๐ File Viewing and Editing#
# Displays the contents of a file
cat <file_name>
# Views a file with pagination
less <file_name>
# Edits a file using Nano editor
nano <file_name>
# Searches for a string in a file
grep <string> <file_name>
๐ Networking#
# Shows IP address information
ip a
# Pings a host to check connectivity
ping <host>
# Displays active network connections
netstat -tuln
# Downloads a file from a URL
wget <url>