November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Dealing with a large active log

Dealing with a large active log

When the log size gets to say 1GB we want to back it up in another directory and empty the current log file.

Therefore basically we are doing:

cp SystemOut.log <some dir with large space> cat /dev/null > SystemOut.log

 

 

Linux Commands

To view System Resource Information uname –help uname -r grep model /proc/cpuinfo grep MemFree /proc/meminfo sudo -u root lastcomm -f /var/account/pacct cat /proc/version # cat /proc/cpuinfo # cat /proc/meminfo # cat /proc/zoneinfo # cat /proc/mounts cat /etc/redhat-release grep MemTotal /proc/meminfo grep SwapTotal /proc/meminfo df -k /tmp grep “model name” /proc/cpuinfo ifconfig (/sbin/ifconfig) uaname -r lshal:detected […]

Monitor Your System Performance

Monitor Your System Performance in Linux

 

@server ~]# uptime 13:14:02 up 1:30, 2 users, load average: 0.04, 0.26, 0.27

[root@server ~]# ps -eo %u | sort | uniq -c | sort -rn

[root@server ~]# sar -c ## Process/sec Linux 2.6.18-164.el5 (server.scratch.com) 08/24/2011

11:50:01 AM proc/s 12:00:01 PM 6.87 12:10:01 PM 6.90 12:20:01 PM 7.10 […]

How to make LiveCD detect and mount LVM partition?

 

Reestablish Volume Group

To tap into the volume group you wish to work with, make sure /etc/lvm/lvm.conf filters are able to see the /dev/md? devices, and execute the following:

[tempsrv] # vgscan

Reading all physical volumes. This may take a while…

Found volume group “rootvg” using metadata type lvm2

 

which should display the […]

Search and replace recursively on a directory in Linux

Search and replace recursively on a directory in Linux

ere is the small bash shell script to make life simple… This script can do a search for string and replace with a new string recursively in a directory.

——————————————————————————– #!/bin/bash # This script will search and replace all regular files for a string # supplied […]

List folders / directories by size in Linux / AIX / Windows

To list the directory sizes in kilo bytes and largest at the top

du -sk * | sort +0nr du -sk * | sort -nr

To list the directory sizes in Mega bytes and largest at the top du -sm * | sort +0nr du -sm * | sort -nr

To list the directory […]

How to forcefully unmount a Linux / AIX /Solaris disk partition?

Linux / UNIX will not allow you to unmount a device that is busy. There are many reasons for this (such as program accessing partition or open file) , but the most important one is to prevent data loss.

To find out the processes which are active on the partition.

[root@tempsrv ~]# lsof | grep […]

RPM Packages installation and usage

RPM Packages installation and usage RPM Packages installation and usage

Note:

Normal querying doesnot require a root loogin but for installation and uninstalling a package you need to be logged in as root. We can also use regular expressions or wiild-characters with the rpm command.

RPM PACKAGE INSTALLATION/ UNINSTALLATION:

# installing a rpm package with […]

About umask

About umask

umask command will be used for setting the default file creation permissions.

When a file is created, its permissions are set by default depending on the umask setting. This value is usually set for all users in /etc/profile and can be obtained by typing:

# umask

The default umask value is usually 022. […]

About SUID, SGID and Sticky bit

n addition to the basic permissions discussed above, there are also three bits of information defined for files in Linux:

* SUID or setuid: change user ID on execution. If setuid bit is set, when the file will be executed by a user, the process will have the same rights as the owner of the […]