This collection of Solaris OS interview questions has been updated for clarity, modern syntax, and practical context. Each answer includes additional commentary explaining when and why the command is used.
ls -lS
The -S flag sorts files by size (largest first). You can combine it with -h for human-readable sizes: ls -lhS.
ls -a | grep "^\."
Hidden files in UNIX/Linux begin with a dot (.). The -a flag ensures these files are listed.
grep -v '^$' sample.txt > new_sample.txt
This command filters out empty lines and writes the result to new_sample.txt. Alternatively, use sed '/^$/d' sample.txt.
grep "Debug" *.conf
This command finds all lines containing “Debug” in configuration files in the current directory.
tail -f Debug.log
tail -f continuously displays appended lines—useful for monitoring logs while a process is running.
du -k * | sort -nr
This lists disk usage in kilobytes and sorts the results by size. Add -h for a human-readable format.
cd CDMA_3X_GEN*
Using wildcards helps navigate to directories with complex names, provided the pattern is unique.
find . -type f
This lists every file with its full path starting from the current directory.
export DISPLAY=$(who am i | awk -F'[()]' '{print $2}')
This extracts the remote IP from who am i and sets it for graphical display redirection.
ps -ef | grep $USER
Lists processes belonging to the current user. For Solaris, ps -fu $USER is also valid.
Ctrl+l — Clear screenCtrl+r — Search command historyCtrl+u — Clear text before cursorCtrl+a — Move to start of commandCtrl+e — Move to end of commandCtrl+d — Exit shellCtrl+z — Suspend current processls -lhS
This lists files in human-readable format, sorted by file size.
man top | col -b > top_help.txt
This removes backspaces and formatting characters from the man page and saves it for offline review.
echo "Script executed at $(date)" >> timeinfo.inf
Logging execution time helps with auditing and troubleshooting automated jobs.
iostat -E
Displays device error statistics, read/write rates, and performance data—useful for diagnosing I/O issues.
du -k
Shows disk usage for files and directories in kilobytes. Combine with sort -nr for ranking.
du -sk * | sort -nr | head
Quickly identifies large files or directories consuming disk space.
quot -af
Summarizes disk usage per user. On newer systems, repquota -a serves the same purpose.
cat /dev/null > filename1
Alternatively, use touch filename1 to create an empty file.
alias psme='ps -ef | grep -i $USER'
Creating aliases reduces typing for frequently used commands.
pagesize
Shows the memory page size used by the kernel. Helps optimize memory-intensive applications.
arp -a
Lists IP-to-MAC address mappings for the local network. Useful for troubleshooting connectivity issues.
netstat -an | grep ESTABLISHED
Shows active TCP connections to or from the host.
netstat -i
Lists network interfaces with packets sent/received and error counts.
ptree <pid>
Shows process relationships, useful for tracing process ownership. Example: ptree 1267.
pwdx <pid>
Displays the current working directory for a specific process ID.
pfiles <pid>
Lists files currently opened by the process. Helpful in debugging file locks or leaks.
ipcs
Shows shared memory segments, message queues, and semaphore sets in use.
prstat -s cpu
prstat is Solaris’s preferred process monitor, sorted here by CPU usage.
top command.prstat -a
Displays system-wide process statistics similar to top but optimized for Solaris.