Basics
mv oldfilename newfilename ### rename file
mv *identifier* /path/ ### move multiple files
cp /path/filename /path ### copy file to new location
./ ### current directory
../ ### move back one directory from current directory
pwd ### prints path
find / -name filename ### find file, looking through whole system
find / -name *.txt ### find all files with specific file extension
find / -type d -name “*jvm*” ### find directory name
find / -name “*.jar” -type f -mmin +$((60*24)) -exec ls -halt {} + | head -10 ### find the last 10 most recently edited har files older that 24 hours
find / -name main.jar -type f -delete; ### find and delete all files with filename
find / -type f -mtime -2 ### all files edited in last 2 days
rm -r -f /path/to/directory ### delete whole directory including all files without prompt
rm -f -R — */ ### removes all folders in current directory without prompt
ll -lt ### list all files in directory with details, can also just use ll
ls ### just list filenames in directory
du -a / | sort -n -r | head -n 30 ### show top 30 directories using disk space
Continue reading “My Linux Command Cheatsheet”