background preloader

Howtos

Facebook Twitter

The Linux OS. UNIX / Linux Command To Check Existing Groups and Users. Q. How do I check the existing Linux / UNIX users and groups under Linux operating system? A. You can easily check the existing users and groups under Linux using the following commands. Find out if user exists in /etc/passwd file /etc/passwd file stores essential information required during login. All you have to do is search this file for user name using following syntax: $ egrep -i "^username" /etc/passwd For, example find out if vivek user exists or not, enter: $ egrep -i "^vivek" /etc/passwd Sample output: vivek:x:1000:1000:Vivek Gite,,,,:/home/vivek:/bin/bash A quick shell script code: #!

Normally, exit status is 0 returned if user accounts (lines) are found and 1 otherwise. Find out if group exists in /etc/group file /etc/group is an text file which defines the groups to which users belong under Linux and UNIX operating system. Id command id is another command to display user / group information for any USERNAME, or the current user. Id: tom: No such user id: ftpuser: No such user #! Www.linfo.org/make_alias_permanent.html. Linux Check Memory Usage. How do I check used and free RAM memory usage under Linux operating systems using command line and GUI tools? Linux comes with different set of commands to check memory usage.

The free command displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The vmstat command reports information about processes, memory, paging, block IO, traps, and cpu activity. Finally, you can use the top, and/or atop/htop commands which provides a dynamic real-time view of a running system. top and friends can display system summary information as well as a list of tasks currently being managed by the Linux kernel. /proc/meminfo The /proc/meminfo file stores statistics about memory usage on the Linux based system. Example Use the cat command or grep command to see /proc/meminfo file: $ cat /proc/meminfo $ less /proc/meminfo $ more /proc/meminfo $ egrep --color 'Mem|Cache|Swap' /proc/meminfo Sample outputs: free command vmstat command. Linux Hardware Compatibility HOWTO. Single list of HOWTOs.