List the files in current directory sorted by size ? - ls -l | grep ^- | sort -nr
List the hidden files in current directory ? - ls -a1 | grep "^\."
Delete blank lines in a file ? - cat sample.txt | grep -v ‘^$’ > new_sample.txt
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.
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.
Display the Disk Usage of file sizes under each directory in currentDirectory ? - du -k * | sort –nr (or) du –k . | sort -nr
Change to a directory, which is having very long name ? - cd CDMA_3X_GEN*Here original directory name is – “CDMA_3X_GENERATION_DATAâ€Â.
Display the all files recursively with path under current directory ? - find . -depth -print
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.
Display the processes, which are running under yourusername ? - ps –aef | grep MaheshvjHere, Maheshvj is the username.
List some Hot Keys for bash shell ? - Ctrl+l – Clears the Screen. Ctrl+r – Does a search in previously given commands in shell. Ctrl+u - Clears the typing before the hotkey. Ctrl+a – Places cursor at the beginning of the command at shell. Ctrl+e – Places cursor at the end of the command at shell. Ctrl+d – Kills the shell. Ctrl+z – Places the currently running process into background.
Display the files in the directory by file size ? - ls –ltr | sort –nr –k 5
How to save man pages to a file ? - man <command> | col –b > <output-file>Example : man top | col –b > top_help.txt
How to know the date & time for – when script is executed ? - Add the following script line in shell script.eval echo "Script is executed at `date`" >> timeinfo.infHere, “timeinfo.inf†contains date & time details ie., when script is executed and history related to execution.
How do you find out drive statistics ? - iostat -E
Display disk usage in Kilobytes ? - du -k
Display top ten largest files/directories ? - du -sk * | sort -nr | head
How much space is used for users in kilobytes ? - quot -af
How to create null file ? - cat /dev/null > filename1
I am looking to determine the total file size of my users, email the data daily, and have it reported in megs. I am using terminal and crontab sucessfully, but I can’t get the crontab entry to report the findings at the user account level. It seems to scan all the way to the end of a uses folder and then report that. Any suggestions?
I can’t install top in SunOS5.6 because of some administration issue.
Furthermore, prstat -a didn’t run in my SunOS5.6. I would like to know whether are there any alternatives for top command in SunOS5.6?
pagesize, prtree, pfiles,pwdx,prstat this commends r not run in my system.
THE CORRECT COMMAND IS :
prtree : pstree(present user login tree)
pwdx : pwd(present working path)
prstate : pstat(present status)
Thank U
Regards,
Kumareasan
Linux Administrator in Tetra software India pvt ltd
This is pretty pathetic. Do folks actually expect candidates who can answer these questsions to be considered systems administrators in a Solaris environment?
Where’s the questions about OBP?
Where’s the questions about LOM?
Where’s the hardware questions?
Where’s the disksuite questions?
What about packages? Jumpstart? JASS? SunVTS? obdiag, prtdiag, fmthard?
What about slices versus disks?
Shared memory? What’s /etc/system for?
How about the ndd command? NFS? RPC?
I can’t install top in SunOS5.6 because of some administration issue.
Furthermore, prstat -a didn’t run in my SunOS5.6. I would like to know whether are there any alternatives for top command in SunOS5.6?
Tech Interviews comment by Wing
Can you tell me what the administration issue is? Have you tried going to sun freeware and get the top package for SunOS 5.6 you will need Gzip to uncompress the file. Then you just run pkgadd -d {path}package-name and it will install without any issues.
How do you vi a file that is too big for the buffer. E.G. When I try to vi a file it says that it is too big and will not work. I know I can use wordpad or someother editor but I am wondering if it can be done with vi. Thanks in advance.
15 Comments on Solaris interview questions
I am looking to determine the total file size of my users, email the data daily, and have it reported in megs. I am using terminal and crontab sucessfully, but I can’t get the crontab entry to report the findings at the user account level. It seems to scan all the way to the end of a uses folder and then report that. Any suggestions?
Alex
I can’t install top in SunOS5.6 because of some administration issue.
Furthermore, prstat -a didn’t run in my SunOS5.6. I would like to know whether are there any alternatives for top command in SunOS5.6?
pagesize, prtree, pfiles,pwdx,prstat this commends r not run in my system.
THE CORRECT COMMAND IS :
prtree : pstree(present user login tree)
pwdx : pwd(present working path)
prstate : pstat(present status)
Thank U
Regards,
Kumareasan
Linux Administrator in Tetra software India pvt ltd
This is pretty pathetic. Do folks actually expect candidates who can answer these questsions to be considered systems administrators in a Solaris environment?
Where’s the questions about OBP?
Where’s the questions about LOM?
Where’s the hardware questions?
Where’s the disksuite questions?
What about packages? Jumpstart? JASS? SunVTS? obdiag, prtdiag, fmthard?
What about slices versus disks?
Shared memory? What’s /etc/system for?
How about the ndd command? NFS? RPC?
I can’t install top in SunOS5.6 because of some administration issue.
Furthermore, prstat -a didn’t run in my SunOS5.6. I would like to know whether are there any alternatives for top command in SunOS5.6?
Tech Interviews comment by Wing
Can you tell me what the administration issue is? Have you tried going to sun freeware and get the top package for SunOS 5.6 you will need Gzip to uncompress the file. Then you just run pkgadd -d {path}package-name and it will install without any issues.
How do you vi a file that is too big for the buffer. E.G. When I try to vi a file it says that it is too big and will not work. I know I can use wordpad or someother editor but I am wondering if it can be done with vi. Thanks in advance.
Comment to comment no. 4, I used to think it was pathetic too, until I got those kind of questions in an interview here in Singapore.
To sort by size in solaris use:
ls -l | sort -nk5
Just like we have “bdf” in HP-UX, is there any command in Solaris and Linux?
with respect to kumareasan comment :
Those commands are in Solaris and Solaris is not Linux. If command not working in your system means commands not exists :)
-Ravi
Rock said,
Just like we have “bdf†in HP-UX, is there any command in Solaris and Linux?
In Linux u can use “df -h”
I don’t know abt solaris i think u can use bdf in solaries
For Solaris you can use df -k as an alternate for bdf of hp unix
10. Display the processes, which are running under yourusername ?
ps -u
Display the processes, which are running under yourusername ?
the command can be used as : ps -u username, or ps -fu username which will give the complete details of the processes running under a user.
Answer for #1
You can use this script under solaris(using “quot” as fundamental of script:-
#!/usr/bin/bash
cp /etc/passwd /tmp/passwd
cut -f1 -d: /tmp/passwd>/tmp/userids
quot -h / /usr /var > /tmp/quotaall
for name in `cat /tmp/userids` ;
do
grep $name /tmp/quotaall | awk ‘{print $1}’ > /tmp/userusagelist
sum=0;
for i in `cat /tmp/userusagelist`;
do
sum=`expr $sum + $i`;
done
summbs=`expr $sum / 1024`;
echo “$name is using $summbs MB”
done