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  

Linux File Find command to find and xargs Detailed

Find command general form;

find pathname-options [-print-exec-ok …]

2, find the parameters of the command;

pathname: the find command to find the path to the directory. For example, used to represent the current directory, use / to represent the system root directory. -Print: find command files that match the output to standard […]

yum command

Task: Display list of updated software (security fix)

Type the following command at shell prompt: # yum list updates

Task: Patch up system by applying all updates

To download and install all updates type the following command: # yum update

Task: List all installed packages

List all installed packages, enter: # rpm -qa # […]

Truncate a File to Zero byte in Linux

Sometimes you need to truncate/empty a file to zero byte length. For example, you have a big file that contains various logs and the size is too big to open it easily. Of course, you can remove this file and touch it again. But this way you will have to play with permissions and file […]

Job Control

View the currently running jobs:jobs

Place running foreground process into background:ctl-z #puts the job to sleepbg %1

Bring a background job into the foreground:fg %1

Kill a job:kill %1kill %1 -9

Find the PID of all jobsjobs -pjobs -pl

Bring a nohuped process to the foreground# note: I think you can only do this from […]

Centos Minimal

scp : samll tips ( error : bash: scp: command not found )

When I try to copy a file over scp command , I’ve faced the following error.

CentOS6-1# /usr/bin/scp aa.tgz hattori@192.168.0.100:hattori@192.168.0.100’s password:bash: scp: command not foundlost connection#

The reason is openssh-clients have not been installed on the remote machine. To […]

How find/kill zombie processes

There are many ways to find out zombie processes , so this is one of examples. # cat /etc/centos-release CentOS release 6.2 (Final)

 

find zombie processes # top -b -n 1 | grep Z 6072 root 20 0 0 0 0 Z 0.0 0.0 0:00.09 dumpcap <defunct> 6075 root 20 0 0 0 0 […]

Linux Commands – Not Usual

Check Validity of a Certificate File (PEM File) # openssl x509 -in Certificates.pem -inform PEM -text -noout -enddate Certificate: Data:

Version: 3 (0x2)

Serial Number:

5b:84:3e:8f:d3:1e:fc:67

Signature Algorithm: sha1WithRSAEncryption

Issuer: C=US, O=Sabe Inc., OU=Sabe Relations, CN=Sabe Certification Authority

Validity

Not Before: Oct 1 11:56:10 2011 GMT Not After : Sep 30 11:56:10 2012 GMT

Sometime […]

free -m

free -m Use ‘free -m’ utility to get REAL memory usage. [u…@server /]# free -m total used free shared buffers cached Mem: 3876 3557 319 0 212 1083 -/+ buffers/cache: 2261 1615 Swap: 0 0 0 That means I have 3876MB total used memory. 2261MB of it is allocated and needed. 1083MB is cached (mostly […]

Tcpdump

Tcpdump is one of the best network analysis-tools ever for information security professionals. Tcpdump is for everyone for hackers and people who have less of TCP/IP understanding. Many prefer to use higher-level analysis tools such Wireshark, but I believe it is a mistake. With tcpdump you can decode layers 2-7 of OSI model. The first […]

kills all pids matching the search word

kills all pids matching the search word

ps -ef | awk ‘/apache/ && !/awk/ {print $2}’ | xargs -r kill -9