Author Topic: Linux: How to Series By:Alok Srivastava part 1  (Read 1492 times)

0 Members and 1 Guest are viewing this topic.

Offline noob

  • Knight
  • **
  • Posts: 202
  • Cookies: 29
    • View Profile
Linux: How to Series By:Alok Srivastava part 1
« on: October 04, 2011, 02:32:46 pm »

1.) Find biggest files / directories: Someme it is necessary to find out what 
file(s) or directories is eang up all disk space. Further it may be necessary to 
find out it at parcular locaon such as /tmp or /var or /home etc.

STEP #1 – Use the “du” command with these opons
  du -a /var | sort -n -r | head -n 10
Where:
-a : Include all files, not just directories (du command)
-h : Human 
-h : Human readable format
-n : Numeric sort (sort command)
--r : Reverse the result of comparisons (sort command)
-n 10 : Display 10 largest file. If you want 20 largest file replace 10 with 20. 

2.)
2.) Execute Command in SSH without opening Shell: Generally whenever we 
intend to run some command on remote machine, we first do a ssh and then 
type the command to be executed. Here is a very small "trick" to be smarter. 
Lets say you want to run "top" command on the machine x.x.x.x using SSH. 
First find out the path of the top command using - whereis top
Second, once you get the path. Now just type this
  ssh -X user@x.x.x.x /path/to/the/command

3.) Change MTU size: On gigabit networks, large maximum transmission units 
(MTU) sizes (JumboFrames) can provide beer network performance for our 
HPC environment. If you want to transfer large amounts of data at gigabit 
speeds, increasing the default MTU size. Can provide significant performance 
gains

STEP #1 – Change MTU size with “ifconfig” command : 
  fconfig eth0 mtu 9000 up

S
STEP #2 – To make this MTU size permanent. Put it under the interface configu-
raon file i.e. /etc/sysconfig/network-scripts/ifcfg-eth0.

  vi   /etc/sysconfig/network-scripts/ifcfg-eth0
  add...
  MTU=”9000”

STEP #3 – Remember to restart the network service: service network restart   

3.)
3.) Collaborate Screens: Suppose you want to show your your friend how to 
solve a problem, but you are on a remote locaon. Soluon is to share the col-
laborate the screen.

STEP #1 Should have "screen" package installed on machines, using yum or 
rpm, then : ssh yourusername@remote-machine
STEP #2 Once you are there run: 
  screen -S anyname 

STEP #3 Then tell your friend to run this command: 
  screen -x anyname 

This
This will make your and your friend's sessions joined together in the Linux 
shell. The benefit is that your friend can watch your troubleshoong skills and 
see exactly how you solve problems.  The one caveat to this trick is that you 
both need to be logged in as the same user. To detach from it and leave it open, 
type: Ctrl-A+D. You can then reaach by running the screen -x anyname com-
mand again.