System Command on Linux

# Monitor the system:
pstreeProcesses and parent-child relationships
topShow top processes
iostatReport CPU statistics and input/output statistics for devices and partitions.
ps -auxwprocess status
uname -aprint system information
cat /proc/versionDisplay Linux kernel version in use.
cat /etc/redhat-releaseDisplay Red Hat Linux Release. (also /etc/issue)
uptimeTell how long the system has been running. Also number of users and system's load average.
wShow who is logged on and what they are doing.
/sbin/lsmodList all currently loaded kernel modules.
Same as cat /proc/modules
/sbin/runlevelDisplays the system's current runlevel.
hostnameDisplays/changes the system's node name. (Must also manually change hostname setting in /etc/sysconfig/network. Command will change entry in /etc/hosts)
serviceRed Hat/Fedora command to display status of system services.
Example: service --status-all
Help: service --help

# Process management :
The basic Linux monitoring commands such as pstree and ps -auxw and top will inform you of the processes running on your system. Sometimes a process must be terminated. To terminate a process:
  1. Identify the process:
    • pstree -p
      OR
    • ps -auxw
      OR
    • top
  2. Kill the process:
    • kill <process-id-number>
    • killall <command-name>


# Memory Usage.
Linux Commands to Monitor Memory Usage:
vmstatMonitor virtual memory
freeDisplay amount of free and used memory in the system. (Also: cat /proc/meminfo)
pmapDisplay/examine memory map and libraries (so). Usage: pmap pid
topShow top processes
sar -BShow statistics on page swapping.
time -v dateShow system page size, page faults, etc of a process during execution. Note you must fully qualify the command as "/usr/bin/time" to avoid using the bash shell command "time".
cat /proc/sys/vm/freepagesDisplay virtual memory "free pages".
One may increase/decrease this limit: echo 300 400 500 > /proc/sys/vm/freepages
cat /proc/meminfoShow memory size and usage

 #Filesystems and Storage Devices. 

df -kreport filesystem disk space usage. (-k reports in Kbytes)
du -shCalculates file space usage for a given directory. (and everything under it) (-s option summarizes)
mountDisplays all mounted devices, their mount point, filesystem, and access. Used with command line arguments to mount file system.
cat /proc/filesystemsDisplay filesystems currently in use.
cat /proc/mountsDisplay mounted filesystems currently in use.
showmountDisplays mount info for NFS filesystems.
cat /proc/swapsDisplays swap partition(s) size, type and quantity used.
cat /proc/ide/hda/any-fileDisplays disk information held by kernel.
Adding an extra hard drive: (See commands and dialog of adding a second IDE hard drive)
  1. fdisk /dev/<drive> - Allocate drive space and register info on the partition table.(Option "n"/"p", then "w" to write.)
  2. mkfs -t ext3 /dev/<drive> - Create file system. (RH 7.1 and earlier use ext2, RH 7.2-8.0 use ext3)
  3. mount -t ext3 /dev/<drive's device name> /<home2 or some suitable directory> - Mount the drive
    Mount a raw ISO file: mount -t iso9660 -o loop /home/user1/RedHat-9.0-i386-Disk1.iso /mnt/iso-1
    (Fstab entry: /home/user1/RedHat-9.0-i386-Disk1.iso /mnt/iso-1 iso9660 loop,ro 0 3)

///////////////////////System Users////////////////////////
# UserInformation:
whoDisplays currently logged in users.
Use who -uH for idle time and terminal info.
usersShow all users logged in.
wDisplays currently logged in users and processes they are running.
whoamiDisplays user id.
groupsDisplay groups you are part of.
Use groups user-id to display groups for a given user.
setDisplay all environment variables in your current environment.
idDisplay user and all group ids.
Use id user-id to display info for another user id.
lastListing of most recent logins by users. Show where from, date and time of login (ftp, ssh, ...) Also see lastlog command.
Show last 100 logins: last -100
historyShell command to display previously entered commands.

Comments

Popular posts from this blog

Error : DependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.adobe.aem:uber-jar:jar:apis -> version 6.3.0 vs 6.4.0

Operators in Asterisk with Linux

ERROR Exception while handling event Sitecore.Eventing.Remote.PublishEndRemoteEventException: System.AggregateExceptionMessage: One or more exceptions occurred while processing the subscribers to the 'publish:end:remote'