Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- whoami --> current user
- man whoami --> manual about certain command
- clear --> clear the screen (Ctrl+L)
- pwd --> current dir
- ls --> lists the files and folder in current dir
- ls /folder_path --> lists the files and folder in certain folder
- ls -l --> permisions, date and etc..
- ls -a --> including dot (hidden) files
- ls -al --> combine options
- cd --> change dir
- cd .. --> previous dir
- cd /../../ --> 2 previous dirs
- cd ~ --> home dir
- mkdir folder_name folder_name2 --> makes directories
- mkdir -p fl1/fl2/fl3 --> creates folder1 and inside folder 1 creates folder 2 and so on..
- touch file1.txt some_image.png --> creates file/s
- touch app.{js,html,css} --> creates app.js, app.html, app.css empty files
- touch {1..3}.txt --> creates 1.txt, 2.txt, 3.txt empty files
- rm -rv file1.txt some_file.jpg --> remove files and prints the deleted ones (-v verbose)
- mv pear.txt renamed_pear.txt --> rename a file
- mv some_folder/ SOME_folder --> rename a folder
- mv pear.txt some_img.png Some_Folder/ --> moves the files in certain folder
- cp file1.txt file2.txt --> makes a copy of file1
- cp -rv folder1/ another_folder --> folder copying
- head -7 file1.txt --> shows the first 7 lines of the file
- tail -7 file1.txt --> shows the last 7 lines of the file
- date > file1.txt --> replace the content of file1.txt with current date (instead of date it could be any command)
- ls -l >> file1.txt --> appends the list of current files and dirs in file1.txt
- cat file1.txt file2.txt --> prints the content of a files
- cat f1.txt f2.txt > new_file.txt --> concatenates 2 files into another new file
- cat -n f1.txt --> prints the file with a number on every row
- less f1.txt --> enters in a reading mode in a file (after that '/ someword' search for a word in the file)
- echo "some text" > file1.txt --> creates a file with some text
- echo *.??? --> prints every file name, that ends with a dot, and after the dot there are 3 chars
- echo app.{js,txt,html} --> app.js app.txt app.html
- wc file1.txt --> word count - prints rows/words/characters
- ls -l | wc > file1.txt --> Piping - combines commands
- sort file1.txt --> prints an alphabetically sorting of a file
- uniq file1.txt --> removes adjacent duplicates
- cmd | cmd | cmd .. --> pipe takes the output from one command and pass it as input to another (works from left to right)
- diff -u file1 file2 --> shows the difference between files (github style)
- find . -name '*a*' --> find everything with an 'a' in the name (files, dirs)
- grep green file1.txt --> highlights the matches of the word 'green' in file1
- du -h --> lists size of dirs
- history --> lists the history of the written commands
- history | grep 'some_word' --> searching for a certain word in the written commands
- ps --> current processes
- kill -9 PID --> force end a process (PID can be shown when type 'ps a')
- killall -9 node --> kills every process with a name 'node'
- some_command & --> runs a process in the background
- jobs --> shows the background processes
- gzip -k filename --> keeps the original file and a new compressed one
- gunzip filename --> extracts a compressed file
- tar -cf archive.tar file1.txt file2.txt --> adds two files into archive
- nano filename --> opens and edit a file (text editor)
- alias custom_command='ls -l' --> makes a custom command (shortcut) works only in the current terminal session
- cat file1.txt | xargs rm --> xargs pass the elaments of file1 in a list for 'rm' which removes them
- ln original_file copy_file --> creates a hard link (copy_file) which referes to the original one (both are pointing to the same file in memory)
- ln -s original_file copy_file --> something like a shortcut (if original is deleted, copy_file points to nothing)
- su another_username --> switch user
- sudo --> 'superuser do' gives admin privileges
- passwd --> change password
- Permissions of the file attributes:
- 1st char --> type:
- - --> file
- d --> directory
- l --> symlink (shortcut)
- 2nd, 3rd and 4th chars (permissions of the owner):
- r --> read
- w --> write
- x --> execute
- if it's '-' instead of 'r', it means the user cannot read the file and etc.
- 5th, 6th and 7th chars (permissions for the group owner and the members of the group):
- same possible group rwx
- 8th, 9th and 10th chars (permissions for everyone else):
- same possible group rwx
- chmod mode file --> change permissions
- chmod a-rw file1.txt --> '-' removes 'r' read and 'w' write permisions for 'a' everyone
- chmod a=r file1.txt --> '=' leaves 'a' everyone only with 'r' permissions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement