Linux Essential Commands: Beginners
In this blog, we'll explore essential Linux commands that every beginner should know. Whether you're a newcomer or just need a quick refresher. Let's dive into the world of Linux commands together!
Check your present working directory:
The "pwd" command in Linux stands for "Print Working Directory" and is used to display the current directory path in the terminal.
List all the files or directories including hidden files:
The "ls" command in Linux is used to list files and directories in the current directory, and its options can be used to customize the listing.
-l (long format)
-a (include hidden files)
-h (human-readable sizes)Create a nested directory A/B/C/D/E:
The "mkdir -p" command in Linux creates directories and any necessary parent directories in a specified path, ensuring that the entire directory structure exists.
View what's written in a file:
The "cat" command in Linux is used to display the contents of a file in the terminal.
Change the access permissions of files:
The "chmod" command in Linux is used to change the access permissions (read, write, execute) of files and directories, allowing or restricting access to them for users, groups, and others.
Here is a table format showing permission numbers for files and directories in Linux/Unix systems:
Permission | Numeric Value |
Read | 4 |
Write | 2 |
Execute | 1 |
No Access | 0 |
These numeric values are used to represent permissions for users, groups, and others in octal notation when using the chmod command. You can combine these values to assign specific permission sets to files and directories.
Check which commands you have run till now:
The "history" command in Linux displays a list of previously executed terminal commands, allowing users to review and reuse command-line history.
Remove a directory/ Folder:
The "rm" command in Linux is used to remove/delete files and directories from the file system.
Create a fruits.txt file and view the content. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
Show only the top three fruits from the file:
Show only the bottom three fruits from the file:
Create another file Colors.txt. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple and Grey:
Find the difference between fruits.txt and Colors.txt file:
Thank you!