May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Solaris Commands

1. List the files in current directory sorted by size ?

 
ls -l | grep ^- | sort -nr

2. List the hidden files in current directory ?
ls -a1 | grep “^\.”

3. Delete blank lines in a file ?

cat sample.txt | grep -v ‘^$’ > new_sample.txt

4. 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.

5. 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.
6. Display the Disk Usage of file sizes under each directory in currentDirectory ?

du -k * | sort –nr (or) du –k . | sort -nr

7. Change to a directory, which is having very long name ? –

cd CDMA_3X_GEN*Here original directory name is – “CDMA_3X_GENERATION_DATA”.

8. Display the all files recursively with path under current directory ?

find . -depth -print
9
. 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.

10. Display the processes, which are running under yourusername ?

ps –aef | grep mohan , mohan is the username.

11. 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.
12. Display the files in the directory by file size ?
ls –ltr | sort –nr –k 5
13. How to save man pages to a file ?
man | col –b > Example : man top | col –b > top_help.txt
14. 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.
15. How do you find out drive statistics ?
iostat -E
16. Display disk usage in Kilobytes ?
du -k
17. Display top ten largest files/directories ?
du -sk * | sort -nr | head
18. How much space is used for users in kilobytes ?
quot -af
19. How to create null file ?
cat /dev/null > filename1
20. Access common commands quicker ?
ps -ef | grep -i $@
21. Display the page size of memory ?
pagesize -a
22. Display Ethernet Address arp table ?

arp -a

23. Display the no.of active established connections to localhost ?
netstat -a | grep EST
24. Display the state of interfaces used for TCP/IP traffice ?
netstat -i
25. Display the parent/child tree of a process ?
ptree Example: ptree 1267
26. Show the working directory of a process ?

pwdx Example: pwdx 1267

27. Display the processes current open files ?

pfiles Example: pfiles 1267

28. Display the inter-process communication facility status ?
ipcs

29. Display the top most process utilizing most CPU ?

top –b 1

30. Alternative for top command ?
prstat -a

31. How can we find RAM size in solaris server?
Prtconf | grep Memory or prtdiag | grep Memory
32. How to find 32 or 64 bit system instances of OS?
Isainfo –v or –kv
32) All of the standard performance analysis tools are available (for example, vmstat, iostat,
mpstat, pstack, pfiles, gcore, libumem), and a number of additional tools are also provided, including lockstat/plockstat, dtrace, prstat, cpustat, and trapstat. These tools can help identify potential problems or bottlenecks that might be responsible for unnecessarily low performance.

1. vmstat – Report virtual memory statistics

vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

The first report produced gives averages since the last reboot. Additional reports give information on a sampling
period of length delay. The process and memory reports are instantaneous in either case.

2. iostat – report I/O statistics

The iostat utility iteratively reports terminal, disk, and tape I/O activity, as well as CPU utilization. The first line of output is for all time since boot; each subsequent line is for the prior interval only.

iostat 2 4
3. mpstat – report per-processor or per-processor-set statistics

The mpstat command reports processor statistics in tabular form. Each row of the table represents the activity of one processor. The first table summarizes all activity since boot. Each subsequent table summarizes activity for the preceding interval.
All values are rates listed as events per second unless otherwise noted.

mpstat -ap 2 4

4. prstat – report active process statistics

The prstat utility iteratively examines all active processes on the system and reports statistics based on the selected output mode and sort order. prstat provides options to examine only processes matching specified PIDs, UIDs, zone IDs, CPU IDs, and processor set IDs.

-a

Report information about processes and users. In this mode prstat displays separate reports about processes and users at the same time.

-p pidlist

Report only processes whose process ID is in the given list.

-t

Report total usage summary for each user. The summary includes the total number of processes or LWPs owned by the user, total size of process images, total resident set size, total cpu time, and percentages of recent cpu time and system memory.

-u

Report only processes whose effective user ID is in the given list. Each user ID may be specified as either a login name or a numerical user ID.
Proc tools:
The proc tools are utilities that exercise features of /proc (see proc(4)). Most of them take a list of process-ids (pid). The tools that do take process-ids also accept /proc/nnn as a process-id, so the shell expansion /proc/* can be used to specify all processes in the system.

pflags Print the /proc tracing flags, the pending and held signals, and other /proc status information for each lwp in each process.

pcred Print or set the credentials (effective, real, saved UIDs and GIDs) of each process.

pldd List the dynamic libraries linked intoeach process, including shared objects explicitly attached using dlopen(3C).
psig List the signal actions and handlers of each process. See signal.h(3HEAD).

pstack Print a hex+symbolic stack trace for each lwp in each process.

pfiles Report fstat(2) and fcntl(2) information for all open files in each process. In addition, a path to the file is reported if the information is available from /proc/pid/path. This is not necessarily the same name used to open the file. See proc(4) for more information.
pwdx Print the current working directory of each process.

pstop Stop each process (PR_REQUESTED stop).

prun Set each process running (inverse of pstop).

pwait Wait for all of the specified processes to terminate.

ptime Time the command, like time(1), but using microstate accounting for reproducible precision. Unlike time(1), children of the command are not timed.
OPTIONS
The following options are supported:

-F Force. Grabs the target process even if another
process has control.

-n (psig and pfiles only) Sets non-verbose mode.
psig displays signal handler addresses rather
than names. pfiles does not display verbose
information for each file descriptor. Instead,
pfiles limits its output to the information
that would be retrieved if the process applied
fstat(2) to each of its file descriptors.

-r (pflags only) If the process is stopped,
displays its machine registers.

-v (pwait only) Verbose. Reports terminations to
standard output.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>