Basic Linux Command Cheat Sheet
Navigation
cd [directory]
: Change directory.pwd
: Print the current working directory.ls [options] [directory]
: List files and directories.mkdir [directory]
: Create a new directory.rmdir [directory]
: Remove an empty directory.cp [options] [source] [destination]
: Copy files and directories.mv [options] [source] [destination]
: Move or rename files and directories.
File Operations
touch [file]
: Create a new empty file or update the timestamp of an existing file.cat [file]
: Concatenate and display the contents of a file.head [options] [file]
: Output the first part of a file.tail [options] [file]
: Output the last part of a file.less [file]
: View file contents interactively.rm [options] [file]
: Remove files and directories.chmod [options] [mode] [file]
: Change file permissions.
File Searching
find [path] [expression]
: Search for files and directories.grep [options] [pattern] [file]
: Search for text patterns in files.locate [file]
: Find files by name.which [command]
: Show the location of a command.
Process Management
ps [options]
: Display information about active processes.top
: Monitor system processes in real-time.kill [options] [PID]
: Terminate a process.killall [options] [process]
: Terminate all processes by name.
System Information
uname [options]
: Print system information.whoami
: Print the username of the current user.hostname
: Print the name of the current host.df [options]
: Display disk space usage.free [options]
: Display memory usage.uptime
: Show system uptime.
File Compression
tar [options] [file]
: Create or extract tar archives.gzip [options] [file]
: Compress files using gzip compression.gunzip [options] [file]
: Decompress files compressed with gzip.
Network
ping [options] [host]
: Send ICMP echo requests to a host.ifconfig
: Display network interface information.ip [options]
: Show or manipulate routing, devices, and policy routing.ssh [user@]host
: Connect to a remote server using SSH.wget [options] [URL]
: Download files from the web.
System Administration
sudo [command]
: Execute a command with superuser privileges.su [username]
: Switch to another user account.passwd [username]
: Change a user's password.apt [options] [command]
: Package management command for APT.systemctl [options] [command]
: Control the systemd system and service manager.
Conclusion
This cheat sheet covers some of the basic Linux commands for navigation, file operations, process management, system information, file searching, network-related tasks, file compression, and system administration. It serves as a handy reference for both beginners and experienced users.
Feel free to explore these commands further and refer to the command's manual page (man [command]
) for more detailed information.
Happy Linux command line exploration!