Posts

Showing posts from 2013

How to run filesystem and RAW I/O's on RHEL / CentOS (Testing Purpose)

"dd" Command is used to monitor write performance of a disk on the Linux OS. Typical DD syntex: dd if=/dev/<input_file> of=/path/to/<output_file bs=<block-size> count=<number-of-blocks> <other_options> Use the dd command to : 1. Measure server throughput (write speed) dd if=/dev/zero of=/tmp/out-file1.img bs=1G count=1 oflag=dsync Note: "oflag=dsync" option means use synchronized I/O for data. It doesn't use cache and gives accurate results 2. Measure server latency dd if=/dev/zero of=/tmp/out-file1.img bs=512 count=1000 oflag=dsync If you want to run RAW IO on a disk directly for long time you can run dd command in while loop loop; # while true;do dd if=/dev/zero of=/dev/sdb bs=2048 count=5000 oflag=dsync;sync;done; To come out of this loop use "Ctrl + C".

Linux Tricks

Here are some of the tricks, i'll keep it updating as i'll get something new. Cheers :) 1 . use "ftp 0" or "ssh 0" command instead of typing "ftp 0.0.0.0" or "ssh localhost" or "ftp localhost" for quickly testing newly configured ftpd or sshd service. 2 . See memory and rss usage on your system: #watch ps -A --sort -rss -o pid,comm,pmem,rss 3 . Sample random password generator (put in your ~/.bashrc): genpasswd ( ) { local l= $1 [ "$l" == "" ] && l= 20 tr - dc A-Za-z0-9_ < /dev/urandom | head -c $ { l } | xargs } Run it: genpasswd 16 Output: uw8CnDVMwC6vOKgW 4. You can configure any Linux system to automatically log users out after a period of inactivity. Simply login as the root user and create a file called /etc/profile.d/autologout.sh, # vi /etc/profile.d/autologout.sh Append the following code: TMOUT= 300 readonly TMOUT export T...

How to Record SSH sessions and store into a file.

Many of admins are depend on Putty to record SSH session on a file, but what if you want do it without Putty in to Linux console? What if you want to show live SSH session with recording to someone else while he's also logged to same remote session? Here is the solution :) Use below command while connecting to remote host e.g. "10.20.30.40"; # ssh jerry@10.20.30.40 | tee -a ~/jerry_ssh_file.txt Now either you can see this recorded session later with below command; # cat ~/jerry_ssh_file.txt Or to see it like live session on another remote SSH console or on another terminal use; # tail -f ~/jerry_ssh_file.txt