Wednesday, April 22, 2009

Let's start with Some Tricks & Tips

A cat with Twist

We use cat command to view a text file from top to bottom.If you want to read a text file from bottom to top you can use tac command.

How to mount Windows share on Linux

Most of them needs to frequently access windows from your Linux system.Most of you probably manually mount the  partition every time you require it.You can mount windows partion permenantly  by adding following in /etc/fstab file.

//server/sharename  /home/mountpoint  smb        userrname=user,password=password   1 2 

Change the variables in the above line to the real values, the way it is in your case.

It would work in a home environment, where  you don't mind putting password in a /etc/fstab file.If you want to be cautious,have a script ask for your password and mount the stuff using the smbmount command.However,if you would like to do this as the non-root user,specify the mount point option in /etc/fstab along with th noauto and user options.

  Execute a command at a specific time

The at command is used to run a command at a specific time or date.For example,inorder to remove a directory after one minute, issue the following commands:

#at now+1 min

at>rm -rf dirname

at>updatedb

at>

To remove a directory on a particular day,say on MM/DD/YYYY, use the code below:

#at MM/DD/YYYY

at>rmdir dirname

at>updatedb

at>

  Play Music in VLC without a GUI

In your terminal promp, type the following 

vlc -I ncurses /home/kingfisher/filename.mp3

Where the -I option is, specify the interface-in our case,it's ncurses.It will open a ncurses interface in the termnal,where you can increase or decrease the volume by using A or Z keys and press H for further options.

 Also note that /home/kingfisher/filename.mp3 is an example of a music file.You can open any number of files by using a wild card such as *.mp3.

How to get Server e-mail Alerts on the root login

Append the following line at the end of your ~/.bash_profile

echo ‘ALERT - Root Shell Access on:’ `date` `who` | mail -s “Alert: Root Access from `who | awk ‘{print $6}’`” your@email.com

Replace your@email.com with the actual email account address that you want to the root access alert notification been sent to.

No comments:

Post a Comment