1)How to check your present working directory:
we can check the current working directory by using "pwd" command
2)List all the files or directories:
"ls" command helps you to list files and directories at the current folder location
"ls -la" has two options attached to it.
"l" helps to show the long list of files or with more details.
"a" helps you to include all the hidden files in the result set.
Bonus tip: you can create hidden files by using "." in front of the filename.
3)Creating a nested directory A/B/C/D/E:
"mkdir -p A/B/C/D/E" command can create a nested directory.
-p is to make parent directories as needed and ignore all errors.
"tree" command can show you the nested directory.
Bonus tip: To install "tree" in ubuntu, you have to use “sudo apt-get install tree”.
4)How to see the content of a file:
"cat" command is one of the ways to show the content of a file on the terminal.
And we can create or append text to the file using the same command in a bit different way. I have shown you some of those tricks in the image below.
Bonus tips:
cat -n: This will display the line numbers of your text content
cat -b: It will display the line numbers of only non-blank lines
5)How to change the access permissions of files:
"chmod" command can help you to change the access permission of the file.
"chmod 777 file.txt" will give all possible permissions to "file.txt".
In Linux, there are 3 types of owners: user, group, and others.
File permissions fall into three categories: Read, Write, and Execute.
Below is the symbolic representation of permissions to user, group, and others.
6)Linux command to list all previously executed commands:
"history" command is used to check the commands you have executed till now.
"tail" shows you the last 10 lines.
7)How to create a file called fruits.txt and view the content:
"vi " command can create or open a file in editor mode.
You can use "nano" command to edit and create a file with a better visualisation.
Here I have used "cat" command to show the content of the file.
If this post was helpful, please follow and click the 💚 button below to show your support.
_ Thank you for reading!
_Sudipa