This is a draft cheat sheet. It is a work in progress and is not finished yet.
Files & Directories
pwd |
Show current directory |
cd <dir> cd .. cd ~ |
Change directory Go up one directory Go to home dir |
ls ls -a ls -t ls -S ll ls *.txt |
List files show all (inculding hidden) sort by last modified sort by size alias 'ls -alF' list all .txt files |
mkdir <dir> touch <file> |
Make directory <dir> Make a file |
rmdir <dir> rm -rf [pattern] rm <file> rm -R <dir> |
remove a directory remove directory and all subdirectories remove <file> remove <dir> |
mv [sources] [destination] |
rename / move files or directory |
cp [sources] [destination] cp <file1> <file2> |
copy files or directory copy <file1> to <file2> |
cat <file> |
print the contents of <file> |
less <file> |
view and paginate <file> |
head <file> head -c 5 <file> head -n 5 <file> |
show the first 10 lines of <file> show the first 5 bytes show the first 5 lines |
tail <file> tail -c 5 <file> tail -n 5 |
show the last 10 lines of <file> show the last 5 bytes show the last 5 lines |
nano <file> |
edit the contents of <file> |
vi <file> |
edit the contents of <file> |
vim <file> |
edit the contents of <file> |
file <file> |
to determine the file type |
|