-
-
Save santoshstha/e19d65f1ca22386ed003bb1f0552e0c8 to your computer and use it in GitHub Desktop.
Basic Unix Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| COMMAND | FUNCTIONALITY | |
|---|---|---|
| ls | Lists all files and directories in the present working directory | |
| ls -R | Lists files in sub-directories as well | |
| ls -a | Lists hidden files as well | |
| ls -al | Lists files and directories with detailed information. | |
| ls 'path' | more | Show listing one screen at a time | |
| cd or cd ~ | Navigate to HOME directory | |
| cd .. | Move one level up | |
| cd | To change to a particular directory | |
| cd / | Move to the root directory | |
| cp 'file1' 'file2' | Copy file1 to file2 | |
| cp -r 'dir1' 'dir2' | Copy directory and all subdirs recursively | |
| cat 'newfile' >> 'oldfile' | Append newfile to end of oldfile | |
| mv 'oldfile' 'newfile' | Rename/Move a file | |
| diff 'file1' 'file2' | Show the differences between 2 files | |
| sdiff 'file1' 'file2' | Show the differences between 2 files side by side | |
| chown user | For changing the ownership of a file/directory | |
| chown user:group filename | Change the user as well as group for a file or directory | |
| cat > filename | Creates a new file | |
| cat filename | Displays the file content | |
| cat file1 file2 > file3 | Joins two files file1 and file2 and stores the output in a new file file3 | |
| grep 'pattern' 'file' | Find regular expression in file. | |
| spell 'file' | Display misspelled words. | |
| wc 'file' | Count words in file. | |
| wc -l 'file' | Count the number of lines in a file. | |
| VARIABLE_NAME= variable_value | Create a new variable with a value assigned | |
| echo $VARIABLE | To display the value of a variable | |
| mv file new_file_path | Moves the files to the new location | |
| mv filename new_file_name | Renames the file to a new filename | |
| sudo | Allows regular users to run programs with the security privileges of the superuser or root | |
| rm filename | Deletes a file | |
| rm -r 'dirname' | Remove all files and subdirectories | |
| man | Gives help information on a command | |
| history | Gives a list of all past commands typed in the current terminal session | |
| clear | Clears the terminal | |
| mkdir directoryname | Creates a new directory in the present working directory or at the specified path | |
| rmdir | Deletes a directory | |
| mv | Renames a directory | |
| pr -x | Divides a file into x columns | |
| pr -h | Assigns a header to a file | |
| pr -n | Denotes a file with Line Numbers | |
| lp -nc or lpr c | Prints 'c' number of copies of a File | |
| lp-d or lp-P | Specifies name of the printer | |
| apt-get | Command used to install and update packages | |
| mail -s 'subject -c 'cc-address' -b 'bcc-address' 'to-address' | Command to send email | |
| mail -s 'Subject' to-address < Filename | Command to send email with attachment | |
| sudo adduser username | To add a new user | |
| sudo passwd -l 'username' | To change the password of a user | |
| sudo userdel -r 'username' | To remove a newly created user | |
| sudo usermod -a -G GROUPNAME USERNAME | To add a user to a group | |
| sudo deluser USER GROUPNAME | To remove a user from a group | |
| finger | Shows information of all the users logged in | |
| finger username | Gives information of a particular user | |
| SSH username@ip-address or hostname | login into a remote Linux machine using SSH | |
| ping 'hostname' | To ping and Analyzing network and host connections | |
| top | Details on all Active Processes | |
| ps | Give the status of processes running for a user | |
| ps PID | Gives the status of a particular process | |
| pidof | Gives the Process ID (PID) of a process | |
| kill PID | Kills a process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment