Last few days ran into few linux commands which is very important in day today development, wanted to add it to my blog for later reference:
- Match String and get line number and filename:
grep -n STRING_TO_SEARCH * (* can be filename if you know the file to look into)
- Remove first N lines from a file:
sed -i '1,10d' filename
- Run a shell script as background and have output into a log:
source filetorun.sh readfromit.txt > log.log 2>&1 &
- Check all process by username:
ps -uusername
- Find number of files inside a folder:(cd into the folder and)
ls -1 | wc -l
- Check memory usage in MB:
free -m
- Machine’s uptime:
uptime