Solaris Interview Questions  

Solaris Administrator Interview Questions and Answers

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.

  1. List the files in the current directory sorted by size.
    ls -lS
    
    The -S flag sorts files by size (largest first). You can combine it with -h for human-readable sizes: ls -lhS.
  2. List hidden files in the current directory.
    ls -a | grep "^\."
    
    Hidden files in UNIX/Linux begin with a dot (.). The -a flag ensures these files are listed.
  3. Delete blank lines in a file.
    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.
  4. Search for a string in particular files.
    grep "Debug" *.conf
    
    This command finds all lines containing “Debug” in configuration files in the current directory.
  5. Display new lines appended to a file in real time.
    tail -f Debug.log
    
    tail -f continuously displays appended lines—useful for monitoring logs while a process is running.
  6. Display disk usage for each directory in the current path.
    du -k * | sort -nr
    
    This lists disk usage in kilobytes and sorts the results by size. Add -h for a human-readable format.
  7. Change to a directory with a long name.
    cd CDMA_3X_GEN*
    
    Using wildcards helps navigate to directories with complex names, provided the pattern is unique.
  8. Display all files recursively under the current directory.
    find . -type f
    
    This lists every file with its full path starting from the current directory.
  9. Automatically set the display variable for a remote user session.
    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.
  10. Display processes running under your username.
    ps -ef | grep $USER
    
    Lists processes belonging to the current user. For Solaris, ps -fu $USER is also valid.
  11. List common Bash hotkeys.

    • Ctrl+l — Clear screen
    • Ctrl+r — Search command history
    • Ctrl+u — Clear text before cursor
    • Ctrl+a — Move to start of command
    • Ctrl+e — Move to end of command
    • Ctrl+d — Exit shell
    • Ctrl+z — Suspend current process
    These shortcuts improve command-line productivity and process management.

  12. Display files by size (sorted largest to smallest).
    ls -lhS
    
    This lists files in human-readable format, sorted by file size.
  13. Save a man page to a file.
    man top | col -b > top_help.txt
    
    This removes backspaces and formatting characters from the man page and saves it for offline review.
  14. Log the date and time when a script is executed.
    echo "Script executed at $(date)" >> timeinfo.inf
    
    Logging execution time helps with auditing and troubleshooting automated jobs.
  15. Find drive statistics.
    iostat -E
    
    Displays device error statistics, read/write rates, and performance data—useful for diagnosing I/O issues.
  16. Display disk usage in kilobytes.
    du -k
    
    Shows disk usage for files and directories in kilobytes. Combine with sort -nr for ranking.
  17. Display the top ten largest files or directories.
    du -sk * | sort -nr | head
    
    Quickly identifies large files or directories consuming disk space.
  18. Show space used by each user.
    quot -af
    
    Summarizes disk usage per user. On newer systems, repquota -a serves the same purpose.
  19. Create a null (empty) file.
    cat /dev/null > filename1
    
    Alternatively, use touch filename1 to create an empty file.
  20. Access commonly used commands faster.
    alias psme='ps -ef | grep -i $USER'
    
    Creating aliases reduces typing for frequently used commands.
  21. Display system page size.
    pagesize
    
    Shows the memory page size used by the kernel. Helps optimize memory-intensive applications.
  22. Display the ARP table (Ethernet addresses).
    arp -a
    
    Lists IP-to-MAC address mappings for the local network. Useful for troubleshooting connectivity issues.
  23. Display active established connections.
    netstat -an | grep ESTABLISHED
    
    Shows active TCP connections to or from the host.
  24. Display the state of interfaces for TCP/IP traffic.
    netstat -i
    
    Lists network interfaces with packets sent/received and error counts.
  25. Display parent/child process hierarchy.
    ptree <pid>
    
    Shows process relationships, useful for tracing process ownership. Example: ptree 1267.
  26. Show working directory of a process.
    pwdx <pid>
    
    Displays the current working directory for a specific process ID.
  27. Display open files of a process.
    pfiles <pid>
    
    Lists files currently opened by the process. Helpful in debugging file locks or leaks.
  28. Display inter-process communication (IPC) status.
    ipcs
    
    Shows shared memory segments, message queues, and semaphore sets in use.
  29. Display the top process consuming the most CPU.
    prstat -s cpu
    
    prstat is Solaris’s preferred process monitor, sorted here by CPU usage.
  30. Alternative to the top command.
    prstat -a
    
    Displays system-wide process statistics similar to top but optimized for Solaris.

SEMrush Software 5 SEMrush Banner 5