Basic Linux Commands | All in One Linux Commands Cheetsheet |
-Best Beginner Linux Command Guide
Table of contents
# Create Directory
For creating a single directory
#mkdir /Tiger
For creating multiple directories
#mkdir Lion Elephant Wolf
To create a directory path (directory inside the directory)
#mkdir -p /red/pink/yellow/black
For creating a number of directories
#mkdir /student{1..10}
# For Create File
Touch:
The touch command is used for creating an empty file, we can’t write data in a file, can’t edit or save a file.
Create a single file with the touch command
#touch notes
Create multiple files
#touch physics chemistry math
3. Create a number of files
#touch books{1..10}
# Create File With cat Command
Cat command is used for creating files, adding data in files, read files, we can also append files but we can't edit files.
Syntax of cat command #cat <option> <file name>
To create and write file
#cat > demo.txt
For reading file #
cat < demo.txt
For Append file
#cat >> demo.txt
Ctrl+d is used for writing and quitting files (save & exit)
# For Remove File and Directory
rm: rm command is used for delete files or directory Syntax: #rm <option> <destination>
Options
-r for recursive
-v for verbose
-f for forcefully
For deleting files or directory
#rm -rvf /india/pune
To delete a File or Directory which starts from the D alphabet
#rm -rvf /india/D*
To delete all databases of the current directory
#pwd #rm -rvf *
# For Copy and Paste
**cp: **
cp command is used for copying and pasting files or directories Syntax: #cp <option> <source> <destination>
**Options: ** -r for recursive
-v for verbose
-f for forcefully
For copy file
#cp -rvf /root/demo.txt /home
To copy all data which start from the D alphabet
#cp -rvf /root/D* /home
**# For moving or Rename File And Directory **
mv :
mv stands for a move, mv command is used to move one or more files or directories from one place to another. It is also used for renaming files or directories.
Syntax: #mv <source > <destination>
To move files or directory
#mv /home/demo /root/Desktop
For renaming files or directory
#mv Tiger Tigers
Basic Commands
/ is your root directory
~ is your home directory
1. pwd : it show present working directory
2. ls : it show available files and directory list in present working directory.
3. uname : it show name of kernel (OS)
4. uname -r : it show version of kernel
5. cd : it use for change directory
6. clear : it use for clear screen
7. whoami : it show currently login user name
8. history : it show list of previously used commands
9. date : it show time and date
10. users : Display the username of all users currently logged on the system
11. Clear : Clear Screen
12. lastlog : The lastlog command is used to find the details of a recent login of all users
13. Tail : This command prints the last N number of data of the given input. By default, it prints 10 lines.
14. Chmod : This command is used to change the access permissions of files and directories.
15. Chown : This command is used to change the file Owner or group.
16. Cut : This command is used to extract specific fields or columns from a file or standard input.
**5 ways to become a sudo user in Linux OS ** (1) sudo -i (2) sudo -s (3) sudo su - (4) su -root (5) su -
**# For Installing Packages **
- Install the package with help of the yum command which will look like
yum install package_name
To display brief detail about a package
yum info package_name
To remove the package
yum remove package_name
Installing a package from a local file
./filename
Thanks For Reading! :)
-Rushikesh Mashidkar