Jul 9, 2024
ssh [user]@[server]
.ls
: List files in the current directory.
ls -l
: Detailed list.ls -a
: Include hidden files.pwd
: Print working directory.cd [directory]
: Change directory.
cd ..
: Go back one directory level.cd
: Go back to home directory.touch [filename]
: Create a new file or update the timestamp of an existing file.cp [file] [destination]
: Copy a file.mv [file] [destination]
: Move (or rename) a file.rm [file]
: Delete a file.mkdir [directory]
: Create a new directory.rmdir [directory]
: Remove an empty directory.
rm -r [directory]
: Remove a directory recursively with files.cat [file]
: Display the contents of a file.nano [file]
: Edit a file with the Nano text editor.vim [file]
: Edit a file with the Vim text editor.
i
Esc
, type :wq
echo [text] > [file]
: Write text to a file (overwrites).echo [text] >> [file]
: Append text to a file.shred [file]
: Securely delete a file.ln -s [target] [link]
: Create a symbolic link.chmod +x [file]
: Make a file executable.chown [user] [file]
: Change the ownership of a file.clear
: Clear the terminal screen.whoami
: Display the current user.exit
: Exit the terminal or a user session.sudo [command]
: Run command with superuser privileges.adduser [username]
: Create a new user (Debian-based).useradd [username]
: Add a new user (generic).passwd [username]
: Change a user's password.su [username]
: Switch user.finger [username]
: Display information about a user (requires installation).sudo apt update
(Debian-based)sudo apt install [package]
(Debian-based)yum [command]
man [command]
: Open the manual for a command.what [command]
: Brief description of a command.which [command]
: Locate a command.whereis [command]
: Locate the binary, source, and manual-page files for a command.df -h
: Display free space on mounted filesystems.uname -a
: Print system information.neofetch
: Display system information in a neat format (requires installation).cal
: Display a calendar.free
: Display memory usage.wget [URL]
: Download files from the web.curl [URL] > [file]
: Download files using cURL.zip [zipfile] [file(s)]
: Create a zip archive.unzip [zipfile]
: Extract a zip archive.less [file]
: View file content one page at a time.head [file]
: View the first lines of a file.tail [file]
: View the last lines of a file.cmp [file1] [file2]
: Compare two files.diff [file1] [file2]
: Show differences between two files.sort [file]
: Sort the lines of a file.find [location] -name [filename]
: Search for files.ipconfig
: Display all network interfaces and their IP addresses.ping [address]
: Check connectivity to a host.
ping -c [count] [address]
: Limit the number of ping requests.traceroute [address]
: Display the route packets take to a network host.netstat
: Display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
netstat -tuln
: Show listening ports.ss -tuln
: Another way to check for listening ports.sudo ufw
: Manage the uncomplicated firewall.ps aux
: Display a snapshot of current processes.top
: Display running system processes and their resource usage.htop
: An improved version of top (requires installation).kill [PID]
: Kill a process by its process ID.
kill -9 [PID]
: Force kill a process.pkill [name]
: Kill processes by name instead of PID.sudo systemctl [command] [service]
: Control system services.
start
, stop
, restart
, status
.history
: Show command history.sudo reboot
: Reboot the system.sudo shutdown
: Shut down the system.