Task: What is the Linux command to
To view what's written in a file.
>cat <file_name> cat name_file.sh
#!/bin/bash NAME="john" echo $NAME echo "$NAME" echo "${NAME}!"
To change the access permissions of files.
By using "chmod" command we can change the file permissions.
>chmod 700 <filename>
>chmod u+rw <filename>
>chmod go+x <filename>
To check which commands you have run till now.
>history
To remove a directory/ Folder.
>rm <filename> >rm -r <directoryname>
>rm -rf <directoryname>
To create a fruits.txt file and to view the content.
>nano friuts.txt >cat fruits.txt
Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
>nano devops.txt >echo "Apple" >> devops.txt >echo "Mango" >> devops.txt >echo "Banana" >> devops.txt >echo "Cherry" >> devops.txt >echo "Kiwi" >> devops.txt >echo "Orange" >> devops.txt
>echo "Guava" >>devops.txt
To Show only top three fruits from the file.
>head -3 devops.txt
To Show only the bottom three fruits from the file.
>tail -3 devops.txt
To create another file Colors.txt and to view the content.
>touch Colors.txt >cat Colors.txt
Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, and Grey.
>echo "Red" >>Colors.txt
To find the difference between fruits.txt and Colors.txt file.
>diff fruits.txt Colors.txt