Tech Questions
Tech Questions
Reader faced these questions from Microsoft recruiter, who apparently was hiring straight
out of college.
1. List the files in current directory sorted by size ? - ls -l | grep ^- | sort -nr
2. List the hidden files in current directory ? - ls -a1 | grep "^\."
3. Delete blank lines in a file ? - cat sample.txt | grep -v ‘^$’ > new_sample.txt
4. Search for a sample string in particular files ? - grep “Debug” *.confHere grep
uses the string “Debug” to search in all files with extension“.conf” under current
directory. (more…)