Linux Commands

Linux

These commands are the most commonly used and are a good starting point for learning the Linux command line:

ls: list files and directories
cd: change directory
pwd: print working directory
mkdir: make directory
rmdir: remove directory
touch: create a new file
cp: copy a file or directory
mv: move or rename a file or directory
rm: remove a file or directory

chmod: change file permissions
chown: change file ownership

sudo: run a command with superuser privileges
su: switch to another user

top: display system processes
ps: display process status
kill: terminate a process

df -h: display disk usage
du: display file space usage
free: display memory usage
sudo lshw -short: hardware information

echo: print a message
cat: concatenate and display files
less: display text file contents one page at a time
head: display the first lines of a file
tail: display the last lines of a file
grep: search for a pattern in text

find: find files by name or other criteria
locate: quickly find files by name
which: display the path of a command
whereis: locate the binary, source, and man page files of a command
man: display the manual page of a command
apropos: search the manual page descriptions
info: display information about a command

history: display command history
clear: clear the terminal screen

date: display the current date and time
time: measure the time taken by a command
cal: display a calendar
bc: perform calculator operations

alias: create a short name for a command
unalias: remove a command alias

env: display environment variables
export: set an environment variable

ip a: see your ip address
ip r: see your gateway

uname -a: information (kernel name, hostname, release, etc.)
uname -r: kernel release (shows the version number)

exit: terminate the current session
logout: terminate the current session
reboot: reboot the system
shutdown / poweroff: shut down the system