Linux Tips and Tricks

Are you a linux geek ? Here are some indispensible linux tips and tricks which are must for new and experienced users alike.Lets have a look at them-More Linux Tips and tricks for geeks and newbies alike

Speeding up your hard drive

Get faster file transfer by using 32-bit transfers on your hard drive

Just add the line:

hdparm -c3 /dev/hdX

to a bootup script.If you use SuSE or other distros based on SYS V,

/sbin/init.d/boot.local

should work for you. This enables 32-bit transfer on your hard drive. On some systems it can improve transfer performance by 75%. To test your performance gain, type:

hdparm -t -T /dev/hdX

More DOS-like commands
Many people are moving to Linux because they miss the stability of good old DOS. In that light, many users are typing DOS commands (which originated from UNIX in the first place) that look fine but cause errors. The command "cd.." in DOS is perfectly valid, but Linux balks. This is because "cd" is a command, and any parameter for that command must be separated from the command by a space. The same goes for "cd/" and "cd~". A quick fix is here.

Use your favorite text editor in your home directory to edit the file ".bashrc". The period is there on purpose, this hides the file from normal ls display.

Add the lines:

alias cd/="cd /"
alias cd~="cd ~"
alias cd..="cd .."

And I usually add these...

alias md="mkdir"
alias rd="rmdir -i"
alias rm="rm -i"

and my first and still favorite alias...

alias ls="ls --color"

alias is a powerful tool, and can be used in the .bashrc script as well as from the command line. You can, if you want to spend the time, create your own group of shell commands to suit how you work. As long as you put them in your .bashrc file, they'll be there everytime you log in. Note that if you frequently log in as root, you might want to copy /home/username/.bashrc to /root/.bashrc to keep yourself sane.

Setting your timezone
The timezone under Linux is set by a symbolic link from /etc/localtime[1] to a file in the /usr/share/zoneinfo[2] directory that corresponds with what timezone you are in. For example, since I'm in South Australia, /etc/localtime is a symlink to /usr/share/zoneinfo/Australia/South. To set this link, type:

ln -sf ../usr/share/zoneinfo/your/zone /etc/localtime

Replace your/zone with something like Australia/NSW or Australia/Perth. Have a look in the directories under /usr/share/zoneinfo to see what timezones are available.

  1. This assumes that /usr/share/zoneinfo is linked to /etc/localtime as it is under Red Hat Linux.
  2. On older systems, you'll find that /usr/lib/zoneinfo is used instead of /usr/share/zoneinfo. See also the later section ``The time in some applications is wrong''.

How to do backup with tar ?
You can mantain a list of files that you with to backup into a file and tar it when you wish.

tar czvf tarfile.tar.gz -T list_file

where list_file is a simple list of what you want to include into the tar

i.e:

/etc/smb.conf
/root/myfile
/etc/ppp (all files into the /etc/ppp directory)
/opt/gnome/html/gnome-dev-info.html

How to keep a computer from answering to ping ?

a simple "echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all" will do the trick... to turn it back on, simply

"echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"

 

Stay tuned for more tips and tricks.

 

Cheers

 

 

posted by XERO . Unknown Source. ALL RIGHTS RESERVED.

0 comments:

Need to say something ? Spell it out :)