Remove files
rm file
Remove directory
rmdir directoryname/path
Only removes empty directories
change Directory
cd “DirectoryName/Sub”
rename file
mv filename1 newfilename
put it in the same directory and it will rename the file
list directory contents
ls
remove directory with all contents
rm -r directoryname
remove write-protected directory or file
rm directoryname -r -f
How to find all text that contains “demo” in a file showing the line number
grep “demo” -n filename.txt
Show the 2 most recently modified items in a directory
*Bonus to only show files and exclude directories
ls -t | head -2
Bonus: ls -tp | grep -v / | head -2
What does the sudo command mean
sudo is short for super user do