File System Permission & Hands on Basic Linux Commands

ยท

3 min read

Hello there! Today, we'll embark on a colorful journey to explore some simple but powerful tasks you can do with files and commands on your computer. Don't worry if you're not an IT expert โ€“ we'll make everything easy and fun! ๐Ÿ˜„

File System Permission:-

Linux File Permissions Explained: A Practical Approach

chmod - Command is used to change the permission of file & directory.

take an example:- here,

A) chmod 750 newfile.txt

here,

7 represents: user has permission for (Read, Write, Execute )

5 represents: group has permission for (Read, Execute )

0 represents: other has no permission.

B) chmod 642 newfile.txt

6 represents: user has permission for (Read, Write )

4 represents: group has permission for (Read )

2 represents: other have permission for (Write ).

Task: What is the Linux command to:-

1. To view what's written in a file.

cat - This command is used to view all the contents written in a file.

2. To change the access permissions of files.

chmod - This command is used to change the permissions of a file/directory.

3. To check which commands you have run till now.

history - This command is used to see all previously executed commands.

4. To remove a directory/ Folder.

'rm' and 'rm -r' - these commands are used to remove a file and directory respectively

5. To create a fruits.txt file and to view the content.

touch - This command is used to create empty files.

cat - This command is used to read the content of the created files.

6. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

vi or vim - This is used to create the files and edit the files.

i - to insert something in file

w - to save all the changes.

q - to quit the file without saving changes.

wq-save and quit

7. To Show only top three fruits from the file.

head -n filename: This command is used to view the content from the top.

8. To Show only bottom three fruits from the file.

tail -n filename: This command is used to view the content from the bottom.

9. To create another file Colors.txt and to view the content.

touch - This command is used to create empty files.

cat - This command is used to read the content of the created files.

10. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.

vi or vim - This is used to create the files and edit the files.

11. To find the difference between fruits.txt and Colors.txt file.

diff - This command is used to display the differences in the files by comparing the files line by line.

12. Check your present working directory.

pwd - This command is used to see the present working directory

13. List all the files or directories including hidden files.

ls : to see list of all the files

ls -a: to see list of all the files including hidden files too

14. Create a nested directory A/B/C/D/E

mkdir -p: This command is used to create a nested directory

Congratulations, brave explorer! ๐ŸŽ‰๐ŸŒˆ Remember, with great power comes great responsibility โ€“ handle files and commands with care! ๐Ÿง™โ€โ™‚๏ธ๐Ÿ’ป May your Linux adventures be filled with enchantment and joy! Happy computing! ๐ŸŒŸ๐ŸŒŒ

ย