Directories/Folders
# See directory structure
tree
# Check in which folder currently
pwd
# List files in the current directory
ls
# Go inside subdirectory 'folder'
cd folder
# Go one step up
cd ..
# Go back to your home dir
cd
# Searching for file 'fff'
locate fff
find . -name fff
Files
# Create file named 'fff'
touch fff
# Edit file
nano fff
# Rename 'fff' as 'goodname'
mv fff goodname
# Delete file 'goodname'
rm goodname
# Create another copy of 'fff' at 'another-fff'
cp fff another-fff
# Create folders 'myfolder' 'bigfolder'
mkdir myfolder
mkdir bigfolder
# Move file 'fff' inside 'myfolder'
mv fff myfolder
# Move 'myfolder' inside 'bigfolder'
mv myfolder bigfolder
# Delete folder
rmdir myfolder
Checking file content
# Type content of file 'fff' on screen
cat fff
# Type first/last 10 lines
head fff
tail fff
# Type content of file - page by page
#
# http://helpdeskgeek.com/linux-tips/more-less-command-linux-unix/
#
less fff
more fff
# Count number of lines in file 'fff'
wc fff
‘grep’ pattern matching
# Print lines of file matching the word 'dog'
grep 'dog' fff
# Print lines of file without the word 'dog'
grep -v 'dog' fff
# PERL-like regular expression
grep -P 'cat' fff
Quick file processing
# Sorting file 'fff'
sort fff
# Extracting second column of file 'fff'
cut -f 2 fff
# Joining two files fff1 and fff2
paste fff1 fff2
# Printing unique lines only
uniq fff
# unique with count
uniq -c fff
Redirecting output
# Sending output to file instead of screen
grep -P 'cat' fff > file2
Pipes (or combining multiple commands)
cut -f 1 fff | sort | uniq -c
Processor, memory, disk and network
# Processor and operating system
uname -a
# Disk space
df -h
# Mounted file systems
mount
# RAM
free -g
# Network
netstat -a
References
https://files.fosswire.com/2007/08/fwunixref.pdf
https://www.rain.org/~mkummel/unix.html
https://www.cheatography.com/davechild/cheat-sheets/linux-command-line/