Solaris · Basic Commands

Solaris · Lesson 3

Basic Commands

Daily use Solaris terminal commands for system administrators. File operations, navigation and system information commands. Difference between Linux and Solaris behavior. Practical production examples.

Goal of this lesson

Before managing users, services, storage or networking in Solaris, you must first become comfortable with the command line environment and basic administrative commands.

In this lesson you will learn how to inspect system information, move through directories, read files and check storage usage using safe and beginner-friendly Solaris commands.

These commands form the foundation for almost every advanced Solaris administration task you will perform later in the course.

Core command-line concepts

System inspection

Commands like uname, hostname and date help administrators identify Solaris versions, server names and environment details.

Filesystem navigation

Commands such as pwd, ls and cd allow you to move safely through directories and inspect stored files.

Terminal productivity

Utilities like which, tty and bc improve command-line troubleshooting, scripting and session management.

Step-by-step Solaris command practice

The following examples demonstrate a realistic Solaris terminal workflow. Practice each command carefully and observe how the shell prompt and command output change.

1. Check Solaris system information

Use uname to identify the Solaris version, hostname, kernel and hardware platform.

terminal — bash
solaris-lab
[root@solaris ~]# uname -a
SunOS solaris 5.11 11.4 i86pc i386 i86pc
 
[root@solaris ~]# uname -r
5.11

2. Display the current working directory

pwd shows the exact directory your current terminal session is using.

terminal — bash
solaris-lab
[root@solaris ~]# pwd
/root
 
[root@solaris ~]# cd /var/log
 
[root@solaris /var/log]# pwd
/var/log

3. Check system date and time

Use the date command to verify current server time and timezone settings.

terminal — bash
solaris-lab
[root@solaris ~]# date
Wed Jan 10 14:23:45 IST 2024

4. List files and directories

The ls command displays files and folders inside the current directory.

terminal — bash
solaris-lab
[root@solaris ~]# ls
contact.cvf scripts backup.sh
 
[root@solaris ~]# ls -lh
total 24K
-rw-r--r-- 1 root root 12K Jan 10 11:10 contact.cvf
-rwxr-xr-x 1 root root 2.1K Jan 10 11:15 backup.sh
drwxr-xr-x 2 root root 2 Jan 10 11:18 scripts

5. Navigate between directories

Use cd to move through the Solaris filesystem hierarchy safely.

terminal — bash
solaris-lab
[root@solaris ~]# cd /var/log
 
[root@solaris /var/log]# pwd
/var/log
 
[root@solaris /var/log]# cd ..
 
[root@solaris /var]#

6. Display file contents

The cat command quickly displays text files directly inside the terminal.

terminal — bash
solaris-lab
[root@solaris ~]# cat /etc/release
Oracle Solaris 11.4
Assembled xx Month 20xx

7. Check filesystem disk usage

df -h displays mounted filesystems and available disk space in human-readable format.

terminal — bash
solaris-lab
[root@solaris ~]# df -h
Filesystem Size Used Available Capacity Mounted on
rpool/ROOT/solaris 49G 2.8G 43G 7% /
swap 3.7G 1.7M 3.7G 1% /system/volatile

8. Use the command-line calculator

bc provides simple arithmetic operations directly from the terminal.

terminal — bash
solaris-lab
[root@solaris ~]# bc
5*10
50
quit

9. Locate executable command paths

which identifies the binary that will execute when a command is entered.

terminal — bash
solaris-lab
[root@solaris ~]# which ls
/bin/ls
 
[root@solaris ~]# which bash
/usr/bin/bash

10. Identify the current terminal session

tty displays the pseudo-terminal device attached to the active session.

terminal — bash
solaris-lab
[root@solaris ~]# tty
/dev/pts/0

11. Display or change the hostname

The hostname command identifies the server on a network.

terminal — bash
solaris-lab
[root@solaris ~]# hostname
solaris
 
[root@solaris ~]# hostname host1
 
[root@solaris ~]# bash
 
[root@host1 ~]# hostname
host1

Important command categories

Instead of memorizing commands randomly, it is better to group them by purpose. Most Solaris commands fit into one of the following categories.

System information

Commands such as uname, date and hostname help identify operating system details, time settings and server identity.

Navigation and file listing

Commands like pwd, ls and cd are used for navigating directories and viewing filesystem contents.

Viewing file contents

Commands such as cat, more, less and tail help administrators inspect configuration files and logs safely.

Getting help

The man command provides built-in documentation and usage information for almost every Solaris command.

Good command-line habits

Safe administration practices

  • Verify your current directory before modifying files or running scripts.
  • Use commands like pwd and ls frequently to avoid accidental changes.
  • Read command outputs carefully instead of rushing through terminal sessions.

Learning and troubleshooting

  • Use man pages regularly to understand command options and syntax.
  • Practice commands repeatedly inside a safe Solaris lab environment.
  • Focus on understanding command behavior instead of memorizing outputs.

Important commands covered in this lesson

System and session information

  • uname -a → display complete operating system information
  • uname -r → display Solaris release version only
  • whoami → display currently logged-in user
  • date → display current date and system time

Navigation commands

  • pwd → show current working directory
  • ls → list files and directories
  • cd /path → move to another directory
  • cd .. → move one level upward

Viewing file contents

  • cat /etc/release → display Solaris version information
  • more /var/log/messages → read logs page by page
  • less /var/log/messages → navigate large files easily
  • tail -f /var/log/messages → monitor logs in real time

Processes and storage

  • df -h → display filesystem disk usage
  • du -sh * → display folder sizes
  • ps -ef → display complete process list
  • ps -ef | head → display only top process entries

Practice tasks for your Solaris lab

  • Log in to your Solaris virtual machine and execute every command shown in this lesson.
  • Record the outputs of uname -a,df -h and ps -ef | head to better understand your server environment.
  • Use the man command for at least three commands, such as man ls, man df andman ps.
  • Practice moving between directories and reading files until terminal navigation feels comfortable and natural.

In the next lesson, you will build on these commands while learning user and group management in Solaris.