cat |
Show the contents of the file |
cat -n |
Number all output lines |
mkdir |
Create a new directory |
mkdir -p dir/dir/dir |
Create a dir with child |
mkdir -p parent/{child, child2} |
Create a dir with childs |
mkdir -p parent/{dir1/{child1,child2},dir2 |
Create a parent dir with 2 dirs 2 childs |
rm |
Remove a file |
rm -r |
Remove a directory |
rm -rf |
Remove a directory without confirmation |
rm -rf . |
Remove the current directory |
cp file file |
Copy content of the file to another file |
cp -r dir dir |
Copy content of the dir to another dir |
mv file dir |
Move or rename file or dirs |
touch |
Create a new file |
cat file >>file |
Append file contents to another file |
>file.txt |
Truncates the content after ctrl+c. If not pressed and stay in continuation prompt, all input goes to the file like echo |
head |
Show the first ten lines of a file |
tail |
Show the last ten lines of a file |
head/tail -n 5 file |
Show the last/first five lines of a file |
tail -f |
Streams the last 10 lines |
tail -f -s 2 |
Sleep for approximately 2 seconds |
more |
Display contents of a file page by page |
less |
Show the contents of a file with navigation |
gpg -c file |
Encrypt a file |
gpg file.gpg |
Decrypt an encrypted .gpg file |
wc |
Shows line, word and byte amount |
wc -l |
Shows number of lines |
wc -w |
Shows number of words |
wc -c |
Shows number of bytes (file byte) |
cut |
Learn the usage of this command |
shred |
Overwrite a file to prevent its recovery |
shred -u |
Overwrite a file to prevent its recovery, then delete it |
shred -n 3 |
Overwrite a file 3 times to prevent its recovery |
ls | tee list.txt / ls>list.txt | tee |
List it and writes the output to list.txt |
echo "hello" |
Prints hello to terminal |
echo "hello"> file.txt |
Writes hello to the file.txt |
echo "world">>file.txt |
Adds world to file.txt without removing the file content |