This post is Part One of the summary of some common Linux Shell Commands. So let’s begin.
Seeking Help
It’s important to know where to seek help when we’re not familiar with certain commands, or just have doubts.
whatis
: Quick explanationman
: Manuals, in 8 sectionsinfo
: Provides more description than manual doeswhereis
&which
: find paths
Check Status
Commands to check CPU info, processes status:
top
: Task managerlscpu
: Check CPU infops
: Process statusps aux
: List all processes and their status and resource usagetail -f
: Monitoring log files, etc. in real timestat
: Check file statusdf -h
: Check disk space
Shortcuts
Important shortcuts to make things easier.
tab
: Auto-complete the commands (especially withls
)*
&?
: fuzzy searchCtrl + a
andCtrl + e
alias
: Create command shortcuts.alias -p
shows all.- e.g.
alias ll="ls -alh"
- Remove:
unalias ll
- e.g.
Listings & Paths
Including commands regarding file paths, info, permissions, and more.
ls -dlh
: Current directory’s info, human-readablels -alh
: All files in detail, human-readablels -asSh | sort
: File size, sortedpwd
: print absolute paths.mkdir -p
: Create multiple directories.e.g. Note the use of
{ }
1
mkdir -p test/{lib/,bin/,doc/{info,product}}
Permissions
sudo usermod -G sudo <USER>
: Get sudo privileges.sudo chown <changed USER:changed GROUP> <FILE>
: Change owner & groupchgrp
: change groupumask
read (4), write (2), execute (1)
-
Octal Permission 0 — 1 –x 2 -w- 3 -wx 4 r– 5 r-x 6 rw- 7 rwx chmod 600
&chmod go-rw
: Only owner can read & writechmod 755
&chmod +x
: Permission to executechmod 777
: All Privileges
-