• Shell :
Commands | Description |
---|---|
!! or !$ |
execute previous command |
![x] |
run xth command |
!-[x] |
run last xth command |
which [command] |
print full path of (shell) commands |
whereis [command] |
locate binary, source, and manual-page files for command |
clear |
clear terminal screen |
exit |
exit shell |
exit [x] |
exit shell with exit status x |
history |
shell history |
history [x] |
last x shell history |
sleep [x] |
sleep (pause) terminal for x sec |
reset |
initialize the terminal (resets terminal mode) |
tty |
print file name of terminal connected to standard input |
• System and User :
Commands | Description |
---|---|
su |
switch user - allow switch to another user |
sudo |
superuser do - allow executing commands with elevated/root privileges |
df |
filesystem disk space usage |
du |
estimate file space usage of set of files |
free |
print free and used memory in system |
arch |
print CPU architecture |
dmesg |
print or control kernel ring buffer (logs) |
lsblk |
list block devices information |
lspci |
list PCI devices (buses) information |
lsusb |
list USB devices (buses) information |
hostid |
print numeric identifier for current host |
hostname |
print hostname of current system |
uname |
print system information |
uptime |
show uptime (how long the system has been running) |
halt |
halts system by stopping all processes but does not power off |
poweroff |
poweroff system |
shutdown |
shutdown system |
reboot |
reboot system |
last reboot |
print system reboot history |
id |
print user and group id |
users |
print all logged in users on system |
w |
print who is logged-in and what running |
who |
print logged in user |
whoami |
print current user |
passwd |
change user password |
ps |
snapshot of current processes |
top |
view running system in real-time interactively |
kill [PID] |
kill/terminate process |
• Networking :
Commands | Description |
---|---|
wget [URL] |
non-interactive network retriever, used for downloading files from the web |
curl [URL] |
transfers data from or to a server using URLs |
ping [IP] |
Packet Internet Groper (ping) sends ICMP ECHO_REQUEST to network hosts to test the reachability of a host |
traceroute [IP] |
print the route packets trace to network host |
whois [IP] |
client for the whois directory service |
host [DOMAIN] |
DNS lookup utility converts names to IP addresses and vice versa |
dig [IP] |
Domain Information Groper (dig) retrieves information about DNS Name Servers |
ip |
show / manipulate routing, network devices, interfaces and tunnels (replaces deprecated: ifconfig, route, arp) |
arp |
show / manipulate Address Resolution Protocol (ARP) cache |
ifconfig |
Interface Configuration (ifconfig) configures network interfaces (deprecated) |
route |
show / manipulate the IP routing table (deprecated) |
netstat |
print network connections, routing tables, interface statistics, masquerade connections, multicast memberships, etc. (deprecated) |
nslookup [IP] |
Name Server Lookup (nsookup) queries DNS Servers interactively (deprecated) |
• File Management :
Commands | Description |
---|---|
ls |
list current directory contents (except hidden) |
ls [dir] |
list directory contents |
ls -a |
list directory contents include hidden |
ls -l |
list directory contents in detailed format |
pwd |
print current/working directory (full path) |
cd [dir] |
change directory |
cd - |
change to last directory |
cd .. |
change to one level above current directory |
cd or cd ~ |
change to home directory |
mkdir [dir] |
create directory |
mkdir -p [dir1]/[dir2] |
create directory inside non-existing parent directory |
rmdir [dir] |
remove empty directory |
cp [source] [destin] |
copy files and directories from source to destination |
cp -r [dir1] [dir2] |
copy directories & its content recursively |
mv [source/old] [destin/new] |
rename or move file and directory |
rm [file] |
remove files |
rm -r [file] |
remove files/directories & its content recursively |
cat [file] |
concatenate and print files on standard output |
tac [file] |
concatenate and print files in reverse |
head [file] |
print first 10 lines of file |
head -[x] [file] |
print first x lines of file |
tail [file] |
show last 10 lines of file |
tail -[x] [file] |
show last x lines of file |
more [file] |
paging through content one screenful at time (it is primitive, use less instead) |
less [file] |
paging through content one screenful at time with enhancements |
nl [file] |
number lines of files |
touch [file] |
update modification and access time of file (create if not exist) |
touch -c [file] |
update modification and access time of file but do not create new file |
sort [file] |
sort lines of text files (default alphabetical order) |
uniq [file] |
filter adjacent matching (duplicate) lines from files |
wc [file] |
print line, word and byte counts of files |
wc -l [file] |
print lines count (l-line, m-char, c-byte, w-word ) |
tree [dir] |
list contents of directories in trees format |
file [file] |
print file type |
stat [file] |
display file or file-system status |
locate [file] |
search for entries (files) in locate database |
ln [file] [link] |
create hard link to file |
ln -s [file] [link] |
create symbolic/soft link to file |