Solaris Interview Question



  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.
  5. Display the last newly appending lines of a file during appendingdata to the same file by some processes ? - tail –f Debug.logHere tail shows the newly appended data into Debug.log by some processes/user.
  6. Display the Disk Usage of file sizes under each directory in currentDirectory ? - du -k * | sort –nr (or) du –k . | sort -nr
  7. Change to a directory, which is having very long name ? - cd CDMA_3X_GEN*Here original directory name is – “CDMA_3X_GENERATION_DATA”.
  8. Display the all files recursively with path under current directory ? - find . -depth -print
  9. Set the Display automatically for the current new user ? - export DISPLAY=`eval ‘who am i | cut -d”(” -f2 | cut -d”)” -f1′`Here in above command, see single quote, double quote, grave ascent is used. Observe carefully.
  10. Display the processes, which are running under yourusername ? - ps –aef | grep MaheshvjHere, Maheshvj is the username.


Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment: