Table of contents
- What is the Linux command to view what's written in a file?
- What is the Linux command to change the access permissions of files?
- What is the Linux command to check which commands you have run till now?
- What is the Linux command to remove a directory/folder?
- What is the Linux command to create a fruits.txt file and view the content?
- What is the Linux command to add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava?
- What is the Linux command to show only the top three fruits from the file?
- What is the Linux command to show only the bottom three fruits from the file?
- What is the Linux command to create another file Colors.txt and to view the content?
- What is the Linux command used to add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey?
- What is the Linux command used to find the difference between fruits.txt and Colors.txt files?
What is the Linux command to view what's written in a file?
cat filename
The above command is used to view the content of any files.
What is the Linux command to change the access permissions of files?
chmod
Above command is used to change the permission, but to give particular permissions we can use the following commands with chmod
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.
What is the Linux command to check which commands you have run till now?
history
above command is used to check which commands we run till now.
What is the Linux command to remove a directory/folder?
rmdir directoryname
above command is used to remove any directory or folder.
What is the Linux command to create a fruits.txt file and view the content?
To create file
touch fruits.txt
To view content
cat
The above command is used to create files, we can use nano or vim commands
What is the Linux command to add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava?
touch devops.txt
Apple
Mango
Banana
Cherry
Kiwi
Orange
Guava
The above command is used to add the content, we can also use nano, and vim commands to add content.
What is the Linux command to show only the top three fruits from the file?
head -n 3 devops.txt
The above command is used to show only the top three fruits of file devops.txt.
What is the Linux command to show only the bottom three fruits from the file?
tail -n 3 devops.txt
The above command is used to show only the bottom 3 fruits of file devops.txt.
What is the Linux command to create another file Colors.txt and to view the content?
vim Colors.txt
cat Colors.txt
The above command is used to create files, we can also use the touch, and nano commands to create a file and the cat command is used to view the content of any file.
What is the Linux command used to add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey?
touch Color.txt
Red
Pink
White
Black
Blue
Orange
Purple
Grey
The above command is used to add content, we can also use the nano and vim commands to add content in the file.
What is the Linux command used to find the difference between fruits.txt and Colors.txt files?
diff fruits.txt Color.txt
The above command is used to find the difference between any two files.