Show Menu
Cheatography

Linux CLI Cheat Sheet (DRAFT) by

Command-line Cheat Sheet

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Basic Commands

Sudo su
to change to root
sort
sort the file
ls
list directory
locate
locating files
cp "­fil­ena­me" "new file name"
Copy
netstat
show open ports plus whats connoted to it
rm
Remove
mv
move
cat
concat­­enates files
cd
change Dir
grep
print matching pattern
touch
create file
mkdir
make a folder
wget
Non Intera­­ctive network downloader
env
show enviro­nmental variables.
&
run a command or script in the background
fg
bring it back for foreground
tar
extract zipped files
strings
looking for human readable
pwd
print working dir
 

-Find syntax

find [directory path] -type f -name [filename] F= FILE
find [directory path] -type d -name [filename] D- DIR
-readable human read
find [directory path] -type f -size [size]
c = bytes,k = kilobytes M =megabytes G = gigabytes
find [directory path] -type f -user [username]
find [directory path] -type f -group [group name]
find / -mtime 10: find files that were modified in the last 10 days
find / -atime 10: find files that were accessed in the last 10 day
find / -cmin -60: find files changed within the last hour (60 minutes)
find / -amin -60: find files accesses within the last hour (60 minutes)

-grep syntax

grep "­opt­ion­" "file to look in"
-e pattern to search
-n show line number
-v invert match
-i ignore case
-r recursive