Task: What is the Linux command to:
1. To view what's written in a file.
Viewing the Contents of a File: You can use the cat command to see what's written in a file. For example:
2. To change the access permissions of files.
To modify the access permissions of files, you can use the chmod command. For instance:
chmod +rwx filename to add permissions
chmod -rwx directoryname to remove permissions.
chmod +x filename to allow executable permissions.
chmod -wx filename to take out write and executable permissions.
There are three options for permission groups available to you in Linux.
owners: these permissions will only apply to owners and will not affect other groups.
groups: you can assign a group of users specific permissions, which will only impact users within the group.
users: these permissions will apply to all users, and as a result, they present the greatest security risk and should be assigned with caution.
There are three kinds of file permissions in Linux:
Read (r): Allows a user or group to view a file.
Write (w): Permits the user to write or modify a file or directory.
Execute (x): A user or group with execute permissions can execute a file or view a directory.
3. To check which commands you have run till now.
4. To remove a directory/ Folder.
5. To create a fruits.txt file and to view the content.
6. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
7. Show only the top three fruits from the file.
8. Show only the bottom three fruits from the file.
9. To create another file Colors.txt and to view the content.
10. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
11. To find the difference between fruits.txt and Colors.txt files.
Top comments (0)