Posts

Memory utilisation of processes in AIX

For memory information, we use the command svmon . svmon shows the total usage of physical and paging memory. Command to display top ten processes and users svmon -P -v -t 10 | more Displaying top CPU_consuming processes: ps aux | head -1; ps aux | sort -rn +2 Displaying top memory-consuming processes: ps aux | head -1; ps aux | sort -rn +3 | head Displaying process in order of priority: ps -eakl | sort -n +6 | head Displaying the process in order of time ps vx | head -1;ps vx | grep -v PID | sort -rn +3 Displaying the process in order of real memory use ps vx | head -1; ps vx | grep -v PID | sort -rn +6 Displaying the process in order of I/O ps vx | head -1; ps vx | grep -v PID | sort -rn +4

How to check if I am running a uniprocessor kernel or a multiprocessor kernel?

/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l /unix and see what file /unix it links to. The following are the three possible outputs from the ls -l /unix command and their  corresponding kernels: /unix -> /usr/lib/boot/unix_up                                                            # 32 bit uniprocessor kernel /unix -> /usr/lib/boot/unix_mp                                               ...

Different RUN levels in Linux,Solaris and AIX

RedHat Linux - Run Levels    0: Halt 1: Single user mode 2: Multiuser, without NFS 3: Full multiuser mode 4: Unused 5: X11 6: Reboot   Solaris - Run Level    S: Single user state (useful for recovery) 0: Access Sun Firmware ( ok> prompt) 1: System administrator mode 2: Multi-user w/o NFS 3: Multi-user with NFS ( default run level) 4: Unused 5: Completely shutdown the host (like performing a power-off @ OBP) [ thanks to Marco ] 6: Reboot but depend upon initdefault entry in /etc/inittab AIX - Run Levels 0-1: Reserved for future use 2: Multiuser mode with NFS resources shared (default run level) 3-9: Defined according to the user's preferences m,M,s,S: Single-user mode (maintenance level) a,b,c: Starts processes assigned to the new run levels while leaving the existing processes at the current level running Q,q: init command to reexamine the /etc/inittab file Command to see Run level:- $ who -r Output: . run-level 3 ...

Rotating Log Files

This script moves on log files listed on the command line. It keeps all but the most recent one compressed, and removes the last one once there are more than CYCLES of them. For example, CYCLES=3 ; rotate messages Would have the following effects. messages --> messages.1 messages.1 --> messages.2.gz messages.2.gz --> messages.3.gz messages.3.gz --> removed script : #!/bin/sh # Rotate a log file and keep N copies # Mostly stolen from inn CYCLES=${CYCLES-5} COMPRESS=/usr/local/bin/gzip Z=.gz for F in $* ; do ## Compress yesterday’s .1 test -f ${F}.1 \ && ${COMPRESS} <${F}.1 >${F}.1${Z} \ && rm -f ${F}.1 \ && chmod 0440 ${F}.1${Z} ## Do rotation. EXT=${CYCLES} rm -f ${F}.${CYCLES}${Z} while [ ${EXT} -gt 0 ] ; do NEXT=${EXT} EXT=‘expr ${EXT} - 1‘ test -f ${F].${EXT}${Z} \ && rm -f ${F}.${NEXT}${Z} \ && mv ${F}.${EXT}${Z} ${F}.${NEXT}${Z} done mv ${F} ${F}.1 done

What is a sticky Bit and how to set it in Linux?

Image
What is Sticky Bit? Sticky Bit is mainly used on folders in order to avoid deletion of a folder and its content by other users though they having write permissions on the folder contents. If Sticky bit is enabled on a folder, the folder contents are deleted by only owner who created them and the root user. No one else can delete other users data in this folder(Where sticky bit is set). This is a security measure to avoid deletion of critical folders and their content(sub-folders and files), though other users have full permissions. Learn Sticky Bit with examples:   Example: Create a project(A folder) where people will try to dump files for sharing, but they should not delete the files created by other users.     How can I setup Sticky Bit for a Folder? Sticky Bit can be set in two ways Symbolic way (t,represents sticky bit) Numerical/octal way (1, Sticky Bit bit as value 1) Use chmod command to set Sticky Bit on Folder: /opt/dump/ Symbolic...

What is SUID and how to set SUID in Linux/Unix?

Image
What is SUID and how to set it in Linux? SUID (Set owner User ID up on execution) is a special type of file permissions given to a file. Normally in Linux/Unix when a program runs, it inherits access permissions from the logged in user. SUID is defined as giving temporary permissions to a user to run a program/file with the permissions of the file owner rather that the user who is running it. In simple words users will get file owner’s permissions as well as owner UID and GID when executing a file/program/command. The above sentence is bit tricky and should be explained in-depth with examples. Learn SUID with examples:   Example1: passwd command When we try to change our password we will use passwd command which is owned by root. This passwd command file will try to edit some system config files such as /etc/passwd, /etc/shadow etc when we try to change our password. Some of these files cannot be opened or viewed by normal user only root user will h...

What is SGID and how to set SGID in Linux?

Image
What is SGID? SGID (Set Group ID up on execution) is a special type of file permissions given to a file/folder. Normally in Linux/Unix when a program runs, it inherits access permissions from the logged in user. SGID is defined as giving temporary permissions to a user to run a program/file with the permissions of the file group permissions to become member of that group to execute the file. In simple words users will get file Group’s permissions when executing a Folder/file/program/command. SGID is similar to SUID. The difference between both is that SUID assumes owner of the file permissions and SGID assumes group’s permissions when executing a file instead of logged in user inherit permissions.   Learn SGID with examples: Example: Linux Group quota implementation   When implementing Linux Group quota for group of people SGID plays an important role in checking the quota timer. SGID bit set on folder is used to change their inherit permissions ...