Thursday, 1 October 2009

How to print the messages from the recent system boot

To print the message from the recent system boot


~$ dmesg    

How to Copy files

To copy file

~$ cp file1 file2 

 

Show name and version of distribution

To show name and version of distribution

~$ head /etc/issue

How to show the kernel version

T o show kernel version and system architecture

~$ uname -a

How to show the amount of remaining RAM

Show amount of remaining RAM

~$ free -m (-m displays in MB)

Show system reboot history

To Show system reboot history

~$ last reboot

Make a ogg file from a wave file

To make a ogg file from a wav file

~$ oggenc --tracknum='track' track.cdda.wav -o 'track.ogg

Clear a CDRW

To clear a CDRW ,type

~$ cdrecord -v dev=/dev/cdrom blank=fast

Make a pdf of a manual page

make a pdf of a manual page

~$ man -t man | ps2pdf - > man.pdf

Print or set system name

Print or set system name

~$ hostname [name]

Display message on screen

Display message on screen ,writes each given string to standard out

~$ echo [string]

eg: ~$ echo how r u ?

Briefly list directory contents

Briefly list directory contents

~$ dir

Display free disk space

To Display free disk space

~$ df

Clear terminal screen

To clear terminal screen


       ~$ clear

Display the contents of a file

To Display the contents of a file


~$ cat filename

eg : ~$ cat hello

Display a calendar in command line

To Display a calendar in command line


     ~$ cal

To make a directory

to make a directory


    ~$ mkdir name

To start & stop a service

To start or stop a service


      ~$ /etc/init.d/service name

eg: ~$ /etc/init.d/gdm start

     ~$ /etc/init.d/gdm stop

How To Burn DVD’s from the command line

Suppose you want to burn the content of /my/directory/datas at the root of the DVD, you need to type:
~$ growisofs -dvd-compat -input-charset=ISO-8859-1 -Z /dev/hda -R -J -pad “/my/directory/datas”
Remember that input-charset is setted to the right value. If you do not define it, your default system charset will be used.

Get the count of files of a specific file type

To know the count of files of a particular type in a directory

         ~$ find . -name “*.png” | wc -l
         ~$ find /usr/share/images/ “*.jpg” | wc -l

Get the total number of lines

If you want to know the total number of lines of files in a directory, execute the following line of script in your terminal. You can also save this command in a file and execute.

lines=0; for i in `find . -name “*.php”`; do line=`cat $i | wc -l`; let lines=$lines+$line; done; echo $lines


OR
find . -name “*.php” -print0 | xargs -0 wc -l | tail -n1

Retrieve default gnome-panel

To retrieve gnome-panel to default, if deleted. First right click
the mouse and select CREATE LAUNCHER .
In that ,select type as applications and in command type gnome-terminal
(for a terminal in GDM ).then type commands listed below in gnome-terminal
 
gnome-session-remove gnome-panel
gconftool-2 --recursive-unset /apps/panel
gnome-panel &

Note : Commands should be executed in terminal of Gnome.

How to know the ALSA version

To know the ALSA (Advance Linux Sound Architecture) version


~$ cat /proc/asound/version

How to install packages in debian

To install an application in debian or debian based distributions :

apt-get install (package name)

 Example:

      :~# apt-get install apache