Command Library
Linux Commands
Core Linux commands for navigation, files, networking, and system tasks.
Navigation
Print working directory
pwdShows the current directory path.
List all files including hidden ones
ls -laUseful for viewing file metadata and dotfiles.
Change directory
cd /path/to/folderMoves to a target folder.
Files & Directories
Create nested directories
mkdir -p project/srcCreates folder structure without failing on existing parents.
Copy directory recursively
cp -r src backup/Copies files and subdirectories.
Rename or move a file
mv old.txt new.txtMoves a file or renames it.
Delete a directory
rm -rf buildRemoves a folder and its contents recursively.
Permissions
Set file permissions
chmod 755 script.shMakes the script executable by the owner.
Change file owner
chown user:user file.txtTransfers ownership to a specific user and group.
Edit system files as admin
sudo nano /etc/hostsOpens a privileged file using sudo.
Processes
List running processes
ps auxDisplays active processes and resource usage.
Monitor system activity
topShows live CPU, memory, and process metrics.
Force stop a process
kill -9 1234Kills a process by PID.
Networking
Show network interfaces
ip aDisplays IP addresses and interface details.
Check connectivity
ping google.comSends ICMP requests to test network reachability.
List listening ports
ss -tulpnShows active TCP/UDP sockets and services.
Package Management
Update package lists and packages
apt update && apt upgradeRefreshes and upgrades Debian/Ubuntu packages.
Install a package
apt install curlInstalls software from the configured repositories.
List installed packages
dpkg -lShows installed Debian packages.
SSH
Connect to a remote server
ssh user@hostLogs into another machine securely using SSH.
Copy file over SSH
scp file.txt user@host:/tmp/Transfers a file to a remote system.
Generate SSH keys
ssh-keygen -t ed25519Creates a secure key pair for passwordless authentication.
Archives
Create a compressed archive
tar -czvf backup.tar.gz folder/Creates a .tar.gz archive.
Extract an archive
tar -xzvf backup.tar.gzExtracts archived content.
Create a ZIP file
zip -r archive.zip folder/Compresses files and folders into a ZIP archive.