My Most Frequently Used Linux Commands
Finding a file containing a string in a given folder
grep -r 'search string' *
Searching the output of a given command for a string
ps aux | grep 'apache2'
Scrolling through the output of a command
ps aux | less
Opening a file as read-only in VIM
vim -R "file name"
Print the current working directory
pwd
Switching to root using sudo
sudo su -
Install a package
apt-get install "package-name"
Getting the contents of a file
cat "file name"
Getting the first 100 lines of a file
head -n 100 "file name"
Getting the last 100 lines of a file
tail -n 100 "file name"
Finding a given file using the current directory as a starting point
find . -name "file name"
List all the files in a directory, human readable, and sort by modified time
ls -halt
List the files with a given extension
ls *.php

