Flipkart

Thursday, January 5, 2017

Linux commands in brief

pstree                                Processes and parent-child relarionships
top                                     Show top processes
ps -auxw                           process status
vmstat                               Monitor virtual memory
free                                   Display amount of free and used memory
in the system. (Also: cat /proc/meminfo)
map                                Display/examine memory map and
libraries (so). Usage: pmap pid
cat /proc/sys/vm/freepages
Display virtual memory “free pages”.
One may increase/decrease this limit:
echo 300 400 500 > /proc/sys/vm/freepages
uname -a                          print system information
cat /proc/version Display Linux kernel version in use.
cat /etc/redhat-release Display Red Hat Linux Release.
(also /etc/issue)
uptime                              Tell how long the system has been
running. Also number of users and
system’s load average.
w                                       Show who is logged on and what they are doing.
 /sbin/lsmod                       List all currently loaded kernel modules. Same as cat /proc/modules
/sbin/runlevel                   Displays the system’s current runlevel .
hostname                          Displays/changes the system’s nodename . (Must also manually change
hostname setting in /etc/sysconfig/network . Command will change entry in                                          /etc/hosts) service Display status of system services.
Example: service –status-all
Help: service –help
df -k                                  report filesystem disk space usage.
(-k reports in Kbytes)
du -sh                                Calculates file space usage for a given
directory. (and everything under it) (-s option summarizes)
mount                               Displays all mounted devices, their
mountpoint, filesystem, and access. Used
with command line arguments to mount file system.
cat /proc/filesystems Display filesystems currently in use.
cat /proc/mounts Display mounted filesystems currently in use.
showmount                      Displays mount info for NFS filesystems.
cat /proc/swaps Displays swap partition(s) size, type and
quantity used.
cat   /proc/ide/hda/anyfile
Displays disk information held by kernel.
who                                   Displays currently logged in users.
Use who -uH for idle time and terminal info.
users                                 Show all users logged in.
w                                       Displays currently logged in users and processes they are running.
whoami                             Displays user id.
 groups                              Display groups you are part of.
Use groups user-id to display groups for a given user.
set                                      Display all environment variables in your current environment.
id                                       Display user and all group ids. Use id user-id to display info for another user id.
last                                    Show listing of last logged in users.
history                              Shell command to display previously entered commands

No comments:

Post a Comment