SunOS is the kernel of the Solaris operating system
There are four types of file systems in Solaris
- UFS
- ZFS
- SAM & QFS
Determine type of file system in Solaris
- The FS type field in the virtual file system table (the /etc/vfstab file)
- The /etc/default/fs file for local file systems
- The /etc/dfs/fstypes file for NFS file systems
Determine SPARC or x86
uname –p
Displays whether the OS is SPARC or x86
usr/sbin/prtconf grep Memory
To Find memory
Directory structure of Solaris
- / – Root
- Every single file and directory starts from the root directory.
- Only root user has write privilege under this directory.
- / is also the root account home directory.
- /dev – Device files.
- Contains device files.
- These include terminal devices, usb, or any device attached to the system.
- For example: /dev/tty1, /dev/usbmon0
- /etc – Configuration files
- Contains configuration files required by all programs.
- This also contains startup and shutdown shell scripts used to start/stop individual programs.
- For example: /etc/services, /etc/resolv.conf, /etc/inetd.conf
- /home – Home Directories
- Home directories for all users to store their personal files.
- For example: /home/john, /home/nikita
- /kernel – Kernel Components
- Contains kernel components common to all platforms within a particular instruction set that are needed for booting the system.
- /sbin – System Binaries
- Just like /bin, /sbin also contains binary executables.
- But, the commands located under this directory are used typically by system administrator, for system maintenance purpose.
- For example: fdisk, mount, swapadd
- /bin – User Binaries
- this points to /usr/bin
- All binaries are located under /usr/bin.
- /lib – System Libraries
- Contains library files that supports the binaries located under /bin and /sbin
- Library filenames are lib*.so.*
- For example: libmtsk.so, libncurses.so.5.7
- /mnt – Mount Directory
- Empty folder generally used for mounting file systems.
- /opt – Optional add-on Applications
- opt stands for optional.
- Contains add-on applications from individual vendors.
- add-on applications should be installed under either /opt/ or /opt/ sub-directory.
- /platform – Platform Definition files
- Contains platform definition files.
- For example: /platform/SUNW,SPARC-Enterprise-T3120, /platform/SUNW,Sun-Blade-T6340
- /proc – Process Information
- Contains information about system process.
- This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
- This is a virtual filesystem with text information about system resources. For example: /proc/uptime
- /tmp – Temporary files
- Directory that contains temporary files created by system and users.
- Files under this directory are deleted when system is rebooted.
- /usr – User Programs
- Contains /usr/bin which is been linked from /bin.
- Contains certain other links such as spool, news, man, mail.
- /var – Variable files
- var stands for variable files.
- Content of the files that are expected to grow can be found under this directory.
- This includes system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); temp files needed across reboots (/var/tmp);
- /vol – Volumes directory
- Disk volumes mounted under this directory.
Commands:
cat filename
Join files or display the contents of a file
cd dir
change directory
chmod mode filename
Change security setting on file
chown user [:group] filename
Change owner [and owning group] of file
chgrp group filename
Change owning group of file
cp f1 f2
Copy files
file filename
Determine a file’s type
head filename
Display first 10 lines of file
head –n filename
Displays the first n lines of a file
ls –la or ls -ltr
List files and directories
mkdir dir
Create or make a directory
more filename
Display contents of a file by screen full
mv [options] Source target
Move or rename a file or a directory
pwd
Print or display current working directory
rm filename
Remove files
rmdir dir
Remove directories
tail filename
Display last 10 lines of file
tail -n filename
Display first 10 lines of file
tail -f filename
Display last n lines of line
wc filename
Count lines, words, and characters in a file
cut
Select column of a file for display
pico
A simple and easy to use menu-driven text editor
sort filename
Sort or merge files
vi
A command-driven full-screen text editor popular among professionals
egrep
Extended version of grep
fgrep
Search files for literal words
find path condition
Finds files matching condition from path downloads
find path -inum n
Finds hard links, i.e., All files with the same i-node number
grep pattern filename
Finds line containing pattern in file
grep -v pattern filename
Finds line NOT containing pattern in file
grep -i pattern filename
Finds all lines containing pattern in file ignoring case
grep
Search files for text pattern
cal
Displays the monthly calendar
clear
Clear the screen
date
Display today’s time and date
finger
Display information about individual users
ftp hostname
Connects to a remote host to upload and download files
kill
Terminate a running command or a process
lp
Print the content of a file
man
Display information about a command
passwd
Change password
ps
Display processes running on a host
prstat
Display iterating list of processes by CPU usage
<ctrl-c>
Interrupt process
<ctrl-z>
Suspend current Process
Kill n
Kill process n
kill -9 n
Terminate process n
talk
Write to others online
telnet hostname [port]
connect to host and opens a shell. Optionally on specified port.
who
Display who are currently logged in
whoami
Display’s the current user
ln file1 name
Create a hard link to file1 called name
ln –s file1 name
Create a soft link to file1 called name
diff f1 f2
Find difference between two files
diff3 f1 f2 f3
Find difference between three files
look word
Searches /usr/dict/words for word
ssh hostname [port]
Makes a secure connection to host and open a shell
jobs
Print list of jobs
fg [%n]
Resume foreground job n
bg [%n]
Resume background job n
stop %n
Suspend background job n
kill [%n]
Kill job n
<ctrl-s>
Stop screen scrolling
<ctrl-q>
Resume Screen output
sleep n
Sleep for n seconds
env
Show environment variables
variable=value
Create local vriable Variable with value value
export Variable
Make Variable an environmental variable
unset variable
Remove environmental vairables
set
Show local variables
alias name1 name2
Create command alias
alias
Show command alias
unalias name1
Remove command alias name1
history
Display recent commands
! n
submit recent command n
set –o vi
Recall commands, edit and re-execute using vi commands
Shell types in Solaris
sh –/bin/sh ,
bash – /bin/bash,
ksh – /bin/ksh,
csh – /bin/csh,
tcsh – /bin/tcsh,
zshell – /bin/zsh
To check shell type in particular host
$ echo $SHELL
/bin/sh
Shell Initialization profiles
/etc/profile ($HOME/.profile) — sh, bash, ksh system wide (per user) init
.profile – Bourne & korn shell
.bash_profile – Bourne Again shell
.login & .cshrc – cshell
.tcshrc & .chrc – TCshell
.zlogin & .zshrc – Z shell