Computer And Technologies

Computer And Technologies: Linux
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, 27 October 2009

Debian dailuse commands

mkdir:-
----------------------
amaresh@eOdissa:~/Documents/Test$ mkdir --help
Usage: mkdir [OPTION] DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.

Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
-Z, --context=CTX set the SELinux security context of each created
directory to CTX
--help display this help and exit
--version output version information and exit

cd - Change working directory:-
---------------------------------------------------------
cd - Change working directory,
cd :- will got respective dir
cd .. :- will go to one position dirctory to current dirctory
cd - :- will go to Old pwd from new pwd










http://www.oreillynet.com/linux/cmd/
http://ss64.com/bash/
http://www.pixelbeat.org/cmdline.html
http://www.debianhelp.co.uk/commands.htm
http://linux.about.com/od/commands/l/blcmdl8_ifconfi.htm
http://linux.about.com/od/lts_guide/a/gdelts47.htm


Resize your Images Using ImageMagick @ deian linux

If you are using Linux and you need to resize a hundred images or so, you can certainly use Gimp, but that would be too much work. Consider ImageMagick set of graphic tools. You can install ImageMagick on Ubuntu by going to the Terminal and typing: “sudo apt-get install imagemagick.” Once the application is installed, all you need to do is go to your image directory and execute the following command:

mogrify -resize 900×600 *.jpg

This command will resize any image with a .jpg extension to a size of 900×600 pixels.

PS:- do backup before doing it.

Thursday, 8 October 2009

How files will share over internet via DROPBOX in Ubuntu ?

Dear all,

http://www.getdropbox.com/static/1254958024/images/logo.png is really a good tool to share any document with anyone over internet.

Steps to work :-
----------------------------------
  1. Follow the Link
  2. download as per your OS, it's working in window, Mac and linux
  3. I have install in Linux (Ubuntu 9.04)
  4. Link for Ubuntu Help
  5. after finish up installation, open terminal and user this command "root@eOdissa:/home/amaresh# dropbox start -i
    Starting Dropbox...Done! "
  6. Look manual page "man dropbox" for more
  7. Open /etc/apt/source.list and add these bellow lines.
Yes! We have an unauthenticated repository for Ubuntu 9.04, 8.10, 8.04, and 7.10.

For Ubuntu 9.04, add the following lines to your /etc/apt/sources.list or equivalent:
deb http://linux.getdropbox.com/ubuntu jaunty main
deb-src http://linux.getdropbox.com/ubuntu jaunty main

For Ubuntu 8.10 add these lines:

deb http://linux.getdropbox.com/ubuntu intrepid main
deb-src http://linux.getdropbox.com/ubuntu intrepid main

For Ubuntu 8.04 you might want to add these lines instead:

deb http://linux.getdropbox.com/ubuntu hardy main
deb-src http://linux.getdropbox.com/ubuntu hardy main

And for Ubuntu 7.10, add these lines:

deb http://linux.getdropbox.com/ubuntu gutsy main
deb-src http://linux.getdropbox.com/ubuntu gutsy main

Then it work fine , you can share data upto 2GB in free


Tuesday, 18 August 2009

Different Linux command @faced in Interview

>chage :-
chage (1) - change user password expiry information

amaresh@eOdissa-desktop:~$ chage -l amaresh
Last password change : Jul 08, 2009
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

>seq:-
seq (1) - print a sequence of numbers

amaresh@eOdissa-desktop:~$ seq 1 4
1
2
3
4
amaresh@eOdissa-desktop:~$ seq 1 2 6
1
3
5
amaresh@eOdissa-desktop:~$ seq 6
1
2
3
4
5
6
amaresh@eOdissa-desktop:~$ seq 1 3 9
1
4
7

>vmstat :-
vmstat (8) - Report virtual memory statistics

usage: vmstat [-V] [-n] [delay [count]]
-V prints version.
-n causes the headers not to be reprinted regularly.
-a print inactive/active page stats.
-d prints disk statistics
-D prints disk table
-p prints disk partition statistics
-s prints vm table
-m prints slabinfo
-S unit size
delay is the delay between updates in seconds.
unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)
count is the number of updates.

Q:What command do you use to get the information about disk statistics?
Ans:- vmstat -d

amaresh@eOdissa-desktop:~$ vmstat -d
disk- ------------reads------------ ------------writes----------- -----IO------
total merged sectors ms total merged sectors ms cur sec
ram0 0 0 0 0 0 0 0 0 0 0
ram1 0 0 0 0 0 0 0 0 0 0
ram2 0 0 0 0 0 0 0 0 0 0
ram3 0 0 0 0 0 0 0 0 0 0
ram4 0 0 0 0 0 0 0 0 0 0
ram5 0 0 0 0 0 0 0 0 0 0
ram6 0 0 0 0 0 0 0 0 0 0
ram7 0 0 0 0 0 0 0 0 0 0
ram8 0 0 0 0 0 0 0 0 0 0
ram9 0 0 0 0 0 0 0 0 0 0
ram10 0 0 0 0 0 0 0 0 0 0
ram11 0 0 0 0 0 0 0 0 0 0
ram12 0 0 0 0 0 0 0 0 0 0
ram13 0 0 0 0 0 0 0 0 0 0
ram14 0 0 0 0 0 0 0 0 0 0
ram15 0 0 0 0 0 0 0 0 0 0
sr0 0 0 0 0 0 0 0 0 0 0
sda 129824 12599 1675591 430108 108073 14333 979288 2993424 0 36


Q:What command do you use to get the information about disk table?
Ans:-vmstat -D

amaresh@eOdissa-desktop:~$ vmstat -D
18 disks
5 partitions
129824 total reads
12599 merged reads
1675591 read sectors
430108 milli reading
107383 writes
13450 merged writes
966704 written sectors
2990880 milli writing
0 inprogress IO
366 milli spent IO

Q:What command do you use to get the information about no of forking ?
Ans:- vmstat -f

amaresh@eOdissa-desktop:~$ vmstat -f
11008 forks


>What command do you use to create swap space?

Thursday, 13 August 2009

Unix Interview questions (sed)

> remove first column of a space delimited txt
how to remove the first column of a space delimited txt file? there are 12+ columns... what is the cleanest way?

cut -d\ -f4-
OR
cat | cut -d\ -f4-
OR
sed -e 's/^[ \t]*//' filename

>delete 7th column in unix,

cut -f1-6,8- filename

>how to remove spaces in a string using sed.

`echo "$infilename" | sed 's/^ *//;s/ *$//`

>replace space or spaces in a line of a file with a single :

sed -e 's/\s/:/g'

>sed : remove whitespace

sed 's/ $//' file1.txt > file2.txt # Remove the last space at eol
sed 's/ *$//' file1.txt > file2.txt # Remove all spaces at eol

>To remove all whitespace (including tabs) from left to first word, enter:

cat | sed -e 's/^[ \t]*//'
Where,

* s/ : Substitute command ~ replacement for pattern (^[ \t]*) on each addressed line
* ^[ \t]* : Search pattern ( ^ - start of the line; [ \t]* match one or more blank spaces including tab)
* // : Replace (delete) all matched pattern

Monday, 10 August 2009

Some Network Linux Commands...

How will you get only TCP protocol status in a network?

Ans:- # netstat -t
O/P:-
root@eOdissa-desktop:/home/amaresh/Documents/Testing# netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 eOdissa-desktop.l:59156 www-sf2p-a.facebook:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:59175 www-sf2p-a.facebook:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:57170 px-in-f83.google.co:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:45271 pv-in-f100.google.c:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:41356 a96-17-8-64.deploy.:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:52631 a96-17-8-48.deploy.:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:41932 ord-qs2-n24.panther:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:54438 px-in-f154.google.c:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:54442 px-in-f154.google.c:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:56950 a96-17-69-27.deploy:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:56949 a96-17-69-27.deploy:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:56948 a96-17-69-27.deploy:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:56947 a96-17-69-27.deploy:www ESTABLISHED
tcp 0 0 eOdissa-desktop.l:53859 221x247x49x219.ap:34580 ESTABLISHED

How will you get only UDP protocol status in a network ?
Ans:- # netstat -u
O/P:-
root@eOdissa-desktop:/home/amaresh/Documents/Testing# netstat -u
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State

How will you find only listening socket information?
Ans:- #netstat -l
O/P:-
root@eOdissa-desktop:/home/amaresh/Documents/Testing# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.152.128 * 255.255.255.128 U 0 0 0 tap0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
192.168.0.0 192.168.152.129 255.255.0.0 UG 0 0 0 tap0
172.16.0.0 192.168.152.129 255.240.0.0 UG 0 0 0 tap0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

How will you get the class of any IP ?
Ans:- ipcals ( install apt-get install ipcalc in debian linux)

O/P:-
root@eOdissa-desktop:/home/amaresh/Documents/Testing# ipcalc 192.168.1.143
Address: 192.168.1.143 11000000.10101000.00000001. 10001111
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
=>
Network: 192.168.1.0/24 11000000.10101000.00000001. 00000000
HostMin: 192.168.1.1 11000000.10101000.00000001. 00000001
HostMax: 192.168.1.254 11000000.10101000.00000001. 11111110
Broadcast: 192.168.1.255 11000000.10101000.00000001. 11111111
Hosts/Net: 254 Class C, Private Internet

root@eOdissa-desktop:/home/amaresh/Documents/Testing#ipcalc 192.168.0.1 255.255.128.0 255.255.192.0
Address: 192.168.0.1 11000000.10101000.0 0000000.00000001
Netmask: 255.255.128.0 = 17 11111111.11111111.1 0000000.00000000
Wildcard: 0.0.127.255 00000000.00000000.0 1111111.11111111
=>
Network: 192.168.0.0/17 11000000.10101000.0 0000000.00000000
HostMin: 192.168.0.1 11000000.10101000.0 0000000.00000001
HostMax: 192.168.127.254 11000000.10101000.0 1111111.11111110
Broadcast: 192.168.127.255 11000000.10101000.0 1111111.11111111
Hosts/Net: 32766 Class C, Private Internet

Subnets after transition from /17 to /18

Netmask: 255.255.192.0 = 18 11111111.11111111.11 000000.00000000
Wildcard: 0.0.63.255 00000000.00000000.00 111111.11111111

1.
Network: 192.168.0.0/18 11000000.10101000.00 000000.00000000
HostMin: 192.168.0.1 11000000.10101000.00 000000.00000001
HostMax: 192.168.63.254 11000000.10101000.00 111111.11111110
Broadcast: 192.168.63.255 11000000.10101000.00 111111.11111111
Hosts/Net: 16382 Class C, Private Internet

2.
Network: 192.168.64.0/18 11000000.10101000.01 000000.00000000
HostMin: 192.168.64.1 11000000.10101000.01 000000.00000001
HostMax: 192.168.127.254 11000000.10101000.01 111111.11111110
Broadcast: 192.168.127.255 11000000.10101000.01 111111.11111111
Hosts/Net: 16382 Class C, Private Internet


Subnets: 2
Hosts: 32764

How will you monitor your LAN IP?
Ans:- iptraf (use apt-get install iptraf in debian linux)

How will you get your bandwidth usages of your interface by host ?
Ans:- iftop

Tuesday, 21 July 2009

Basic Unix commands for beginners!!

passwd
This command allows you to change your login password. You are prompted to enter your current password, and then prompted (twice) to enter your new password. On Linux systems (like haribol) passwords should exceed 6 characters in length, and contain at least one non-alphanumeric character (such as #, %, *, ^, [, or @ etc.)

cd
This command, as in DOS, changes directories. You can use .. to represent the directory above the current directory. You can use ~ to represent your root directory (also called your home or top directory). Example: cd maindir to move into the maindir directory, cd .. to move to the directory above, or cd ~ to move to your root directory.

pwd
This command tells you which directory you are currently working in. Your home directory is represented by the tilde ~ symbol. To go to your home directory from anywhere, type cd ~, however typing cd without the ~ also works on Linux systems.

ls
This gives you a listing of all files in a directory. You can't tell which are files and which are directories.

ls -F
This shows which files are normal files (they have no special symbols at the end), which are directories (they end in a / character), which are links (they end in a @ symbol) and which are executables (they end in a * character). These special symbols are NOT part of the file name.

ls -l
"Long" format. Gives more details about files and directories in the current directory.

ls -a
Lists "hidden" files in current directory (those starting with a . character).

ls -la
Options may usually be combined. This particular combination would list both hidden and unhidden files in the long format

mv
The "move" command is how you rename files. Example: mv oldfile.txt newfile.txt

cp
Allows you to copy one or more files. Example: cp myfile.c backup.c

rm
Deletes a file. BE CAREFUL!! There's no "undelete" command. Example: rm janfiles.*

cat
Sends the contents of a file to stdout (usually the display screen). The name comes from "concatenate." Example: cat index.html

more
Like cat but displays a file one page at a time. Example: more long_file.txt

wc
Counts the number of lines, words, and characters in a file. Example: wc essay.rtf

tail -n
Displays the last n lines of a file. Example: tail -5 myfile

head -n
Displays the first n lines of a file. Example: head -5 myfile

mkdir
Creates a new directory, located below the present directory. (Use pwd first to check where you are!) Example: mkdir new_dir

rmdir
Deletes a directory. Example: rmdir old_dir

man
The most important Unix command! It displays the manual pages for a chosen Unix command. Press [Enter] to advance one line, [Spacebar] to advance one page, and the [Q] key to quit and return to the Unix prompt. Example: man ls

man -k
Displays all Unix commands related to a given keyword. Example: man -k date will list all Unix commands whose man pages contain a reference to the word date.

date
Shows the current time and date.

logout
Terminates the current login session, (and returns you to your telnet client, if that is how you established the session originally).


I/O Redirection

<
Input redirection. This allows you to take input from a file rather than stdin. Example: tr a z

>
Output redirection. This allows you to send output to a file rather than stdout. Example: ls -l >listing

|
Pipe. This allows you to connect stdout from one command with stdin of another. Example: ls -la | more
File Compression:-
    • gzip filename --- compresses files, so that they take up much less space. Usually text files compress to about half their original size, but it depends very much on the size of the file and the nature of the contents. There are other tools for this purpose, too (e.g. compress), but gzip usually gives the highest compression rate. Gzip produces files with the ending '.gz' appended to the original filename.
    • gunzip filename --- uncompresses files compressed by gzip.
    • gzcat filename --- lets you look at a gzipped file without actually having to gunzip it (same as gunzip -c). You can even print it directly, using gzcat filename | lpr
  • printing
    • lpr filename --- print. Use the -P option to specify the printer name if you want to use a printer other than your default printer. For example, if you want to print double-sided, use 'lpr -Pvalkyr-d', or if you're at CSLI, you may want to use 'lpr -Pcord115-d'. See 'help printers' for more information about printers and their locations.
    • lpq --- check out the printer queue, e.g. to get the number needed for removal, or to see how many other files will be printed before yours will come out
    • lprm jobnumber --- remove something from the printer queue. You can find the job number by using lpq. Theoretically you also have to specify a printer name, but this isn't necessary as long as you use your default printer in the department.
    • genscript --- converts plain text files into postscript for printing, and gives you some options for formatting. Consider making an alias like alias ecop 'genscript -2 -r \!* | lpr -h -Pvalkyr' to print two pages on one piece of paper.
    • dvips filename --- print .dvi files (i.e. files produced by LaTeX). You can use dviselect to print only selected pages.

Finding things

  • ff --- find files anywhere on the system. This can be extremely useful if you've forgotten in which directory you put a file, but do remember the name. In fact, if you use ff -p you don't even need the full name, just the beginning. This can also be useful for finding other things on the system, e.g. documentation.
  • grep string filename(s) --- looks for the string in the files. This can be useful a lot of purposes, e.g. finding the right file among many, figuring out which is the right version of something, and even doing serious corpus work. grep comes in several varieties (grep, egrep, and fgrep) and has a lot of very flexible options. Check out the man pages if this sounds good to you.

About other people

  • w --- tells you who's logged in, and what they're doing. Especially useful: the 'idle' part. This allows you to see whether they're actually sitting there typing away at their keyboards right at the moment.
  • who --- tells you who's logged on, and where they're coming from. Useful if you're looking for someone who's actually physically in the same building as you, or in some other particular location.
  • finger username --- gives you lots of information about that user, e.g. when they last read their mail and whether they're logged in. Often people put other practical information, such as phone numbers and addresses, in a file called .plan. This information is also displayed by 'finger'.
  • last -1 username --- tells you when the user last logged on and off and from where. Without any options, last will give you a list of everyone's logins.
  • talk username --- lets you have a (typed) conversation with another user
  • write username --- lets you exchange one-line messages with another user
  • elm --- lets you send e-mail messages to people around the world (and, of course, read them). It's not the only mailer you can use, but the one we recommend.

About your (electronic) self

  • whoami --- returns your username. Sounds useless, but isn't. You may need to find out who it is who forgot to log out somewhere, and make sure *you* have logged out.
  • finger & .plan files
    of course you can finger yourself, too. That can be useful e.g. as a quick check whether you got new mail. Try to create a useful .plan file soon. Look at other people's .plan files for ideas. The file needs to be readable for everyone in order to be visible through 'finger'. Do 'chmod a+r .plan' if necessary. You should realize that this information is accessible from anywhere in the world, not just to other people on turing.
  • passwd --- lets you change your password, which you should do regularly (at least once a year).
  • ps -u yourusername --- lists your processes. Contains lots of information about them, including the process ID, which you need if you have to kill a process. Normally, when you have been kicked out of a dialin session or have otherwise managed to get yourself disconnected abruptly, this list will contain the processes you need to kill. Those may include the shell (tcsh or whatever you're using), and anything you were running, for example emacs or elm. Be careful not to kill your current shell - the one with the number closer to the one of the ps command you're currently running. But if it happens, don't panic. Just try again :) If you're using an X-display you may have to kill some X processes before you can start them again. These will show only when you use ps -efl, because they're root processes.
  • kill PID --- kills (ends) the processes with the ID you gave. This works only for your own processes, of course. Get the ID by using ps. If the process doesn't 'die' properly, use the option -9. But attempt without that option first, because it doesn't give the process a chance to finish possibly important business before dying. You may need to kill processes for example if your modem connection was interrupted and you didn't get logged out properly, which sometimes happens.
  • quota -v --- show what your disk quota is (i.e. how much space you have to store files), how much you're actually using, and in case you've exceeded your quota (which you'll be given an automatic warning about by the system) how much time you have left to sort them out (by deleting or gzipping some, or moving them to your own computer).
  • du filename --- shows the disk usage of the files and directories in filename (without argument the current directory is used). du -s gives only a total.
  • last yourusername --- lists your last logins. Can be a useful memory aid for when you were where, how long you've been working for, and keeping track of your phonebill if you're making a non-local phonecall for dialling in.

Connecting to the outside world

  • nn --- allows you to read news. It will first let you read the news local to turing, and then the remote news. If you want to read only the local or remote news, you can use nnl or nnr, respectively. To learn more about nn type nn, then \tty{:man}, then \tty{=.*}, then \tty{Z}, then hit the space bar to step through the manual. Or look at the man page.
  • rlogin hostname --- lets you connect to a remote host
  • telnet hostname --- also lets you connect to a remote host. Use rlogin whenever possible.
  • ftp hostname --- lets you download files from a remote host which is set up as an ftp-server. This is a common method for exchanging academic papers and drafts. If you need to make a paper of yours available in this way, you can (temporarily) put a copy in /user/ftp/pub/TMP. For more permanent solutions, ask Emma. The most important commands within ftp are get for getting files from the remote machine, and put for putting them there (mget and mput let you specify more than one file at once). Sounds straightforward, but be sure not to confuse the two, especially when your physical location doesn't correspond to the direction of the ftp connection you're making. ftp just overwrites files with the same filename. If you're transferring anything other than ASCII text, use binary mode.
  • lynx --- lets you browse the web from an ordinary terminal. Of course you can see only the text, not the pictures. You can type any URL as an argument to the G command. When you're doing this from any Stanford host you can leave out the .stanford.edu part of the URL when connecting to Stanford URLs. Type H at any time to learn more about lynx, and Q to exit.

-----------------------------------------------------------------------------------------------------------------------------
Unix tutorials

There are a number of excellent Unix tutorials on the Web, including:

Friday, 10 July 2009

Getting Back to a Pure Gnome on Ubuntu from Kbuntu and vice Versa!

If you want to remove kbuntu, then follow the bellow steps :-

If you used aptitude to install other desktop environments, you will not need this tutorial, as you can just type bellow command into your terminal/konsol to get back to your "pure Gnome."

sudo aptitude remove kubuntu-desktop
or
sudo aptitude remove xubuntu-desktop

If you want to remove Ubuntu, then follow the bellow steps:-

If you used aptitude to install other desktop environments, you will not need this tutorial, as you can just type bellow command into your terminal/konsol to get back to your "pure KDE."

sudo aptitude remove ubuntu-desktop
or
sudo aptitude remove xubuntu-desktop

Remove Kubuntu
Paste this command into the terminal:

sudo apt-get remove adept akregator amarok amarok-xine ark arts artsbuilder avahi-daemon bogofilter bogofilter-bdb bogofilter-common debtags enscript flac gtk2-engines-gtk-qt gwenview imagemagick k3b kaddressbook kaffeine kaffeine-xine kamera karm katapult kate kaudiocreator kcontrol kcron kde-guidance kde-style-lipstik kde-systemsettings kdeadmin-kfile-plugins kdebase-bin kdebase-data kdebase-kio-plugins kdebluetooth kdegraphics-kfile-plugins kdelibs-bin kdelibs-data kdelibs4c2a kdemultimedia-kfile-plugins kdemultimedia-kio-plugins kdenetwork-filesharing kdenetwork-kfile-plugins kdepasswd kdepim-kio-plugins kdepim-kresources kdepim-wizards kdeprint kdesktop kdm kdnssd keep kfind kghostview khelpcenter kicker kio-apt kio-locate kitchensync klaptopdaemon klipper kmail kmailcvt kmenuedit kmilo kmix kmplayer-base kmplayer-konq-plugins knetworkconf knotes koffice-data koffice-libs konq-plugins konqueror konqueror-nsplugins konsole kontact konversation kooka kopete korganizer kpdf kpersonalizer kpf kppp krdc krfb krita krita-data kscd kscreensaver kscreensaver-xsavers ksmserver ksnapshot ksplash ksplash-engine-moodin ksvg ksysguard ksysguardd ksystemlog ktorrent kubuntu-artwork-usplash kubuntu-default-settings kubuntu-desktop kubuntu-docs kubuntu-konqueror-shortcuts kwalletmanager kwin kwin-style-crystal language-selector-qt latex-xft-fonts libakode2 libarts1-akode libarts1c2a libartsc0 libavahi-core4 libavahi-qt3-1 libdaemon0 libdbus-qt-1-1c2 libflac++5c2 libgadu3 libgpgme11 libgsl0 libjpeg-progs libk3b2 libkcal2b libkcddb1 libkdepim1a libkipi0 libkleopatra1 libkmime2 libkonq4 libkpimexchange1 libkpimidentities1 libkscan1 libksieve0 libktnef1 liblockdev1 libmimelib1c2a libmodplug0c2 libmpcdec3 libnss-mdns liboggflac3 libopenexr2c2a libpcre3 libpoppler1-qt libpythonize0 libqt-perl libqt3-mt librsync1 libruby1.8 libsamplerate0 libsensors3 libskim0 libsmokeqt1 libtdb1 libtunepimp2c2a libxcomposite1 libxine-main1 libxvmc1 menu-xdg openoffice.org-kde perl-suid poster postfix procmail psutils pykdeextensions python-kde3 python2.4-dev python2.4-kde3 python2.4-qt3 python2.4-sip4-qt3 qca-tls qobex rdiff-backup ruby ruby1.8 scim-qtimm skim speedcrunch ssl-cert vorbis-tools wlassistant

Remove Xubuntu
Paste this command into the terminal:

sudo apt-get remove abiword abiword-common abiword-help abiword-plugins anthy gnumeric-common gnumeric-gtk gqview gtk2-engines-xfce im-switch latex-xft-fonts libaiksaurus-1.2-0c2a libaiksaurus-1.2-data libaiksaurusgtk-1.2-0c2a libanthy0 libbeecrypt6 libchewing-data libchewing2 libenchant1c2a libexo-0.3-0 libgdome2-0 libgdome2-cpp-smart0c2a libgoffice-1-common libgoffice-gtk-1-2 libgsf-gnome-1-113 libgtkmathview0c2a libjpeg-progs libmodplug0c2 libots0 libpcre3 librpm4 libt1-5 libtagc0 libthunar-vfs-1 libwpd-stream8c2a libxcomposite1 libxfce4mcs-client3 libxfce4mcs-manager3 libxfce4util4 libxfcegui4-4 libxine-main1 libxvmc1 mousepad mozilla-thunderbird orage rpm scim-anthy scim-chewing scim-hangul scim-pinyin thunar thunar-media-tags-plugin xarchiver xfburn xfce4-appfinder xfce4-battery-plugin xfce4-clipman-plugin xfce4-cpugraph-plugin xfce4-fsguard-plugin xfce4-icon-theme xfce4-mailwatch-plugin xfce4-mcs-manager xfce4-mcs-plugins xfce4-mixer xfce4-mixer-alsa xfce4-mount-plugin xfce4-netload-plugin xfce4-panel xfce4-quicklauncher-plugin xfce4-screenshooter-plugin xfce4-session xfce4-systemload-plugin xfce4-taskmanager xfce4-terminal xfce4-utils xfce4-verve-plugin xfce4-weather-plugin xfce4-xkb-plugin xfdesktop4 xfmedia xfprint4 xfwm4 xfwm4-themes xscreensaver xubuntu-artwork-usplash xubuntu-default-settings xubuntu-desktop xubuntu-docs

Remove Ubuntu
Paste this command into the terminal:

sudo apt-get remove acpi acpi-support acpid alacarte alsa-base alsa-utils anacron apmd avahi-daemon bc ca-certificates consolekit cupsys cupsys-bsd cupsys-client cupsys-driver-gutenprint dc dcraw desktop-file-utils doc-base eog evince fast-user-switch-applet file-roller foomatic-db foomatic-db-engine foomatic-filters gcalctool gconf-editor gdebi gdm gedit genisoimage ghostscript-x gimp-python gnome-about gnome-app-install gnome-applets gnome-control-center gnome-icon-theme gnome-media gnome-menus gnome-netstatus-applet gnome-nettool gnome-panel gnome-pilot-conduits gnome-power-manager gnome-session gnome-spell gnome-system-monitor gnome-system-tools gnome-terminal gnome-themes gnome-utils gnome-volume-manager gstreamer0.10-alsa gstreamer0.10-plugins-base-apps gstreamer0.10-pulseaudio gtk2-engines gtk2-engines-pixbuf gucharmap hal hotkey-setup hwtest-gtk language-selector launchpad-integration lftp libgl1-mesa-glx libglut3 libgnome2-perl libgnomevfs2-bin libgnomevfs2-extra libpt-1.10.10-plugins-v4l libpt-1.10.10-plugins-v4l2 libsasl2-modules libxp6 metacity nautilus nautilus-cd-burner nautilus-sendto notification-daemon openprinting-ppds pnm2ppa powermanagement-interface pulseaudio pulseaudio-esound-compat readahead rss-glx screen screensaver-default-images scrollkeeper seahorse smbclient software-properties-gtk ssh-askpass-gnome synaptic system-config-printer-gnome tangerine-icon-theme tsclient ttf-bitstream-vera ttf-dejavu-core ttf-freefont ubuntu-artwork ubuntu-sounds unzip update-manager update-notifier usplash usplash-theme-ubuntu x-ttcidfont-conf xdg-user-dirs xdg-user-dirs-gtk xkb-data xorg xscreensaver-data xscreensaver-gl xterm yelp zenity zip app-install-data-commercial apport-gtk avahi-autoipd bluez-cups bluez-gnome bluez-utils bogofilter brasero brltty brltty-x11 bug-buddy cdparanoia compiz contact-lookup-applet cups-pdf deskbar-applet displayconfig-gtk diveintopython dvd+rw-tools ekiga espeak evolution evolution-exchange evolution-plugins evolution-webcal example-content f-spot firefox firefox-gnome-support foo2zjs foomatic-db-hpijs fortune-mod gcc gimp gimp-gnomevfs gnome-accessibility-themes gnome-games gnome-mag gnome-orca gnome-screensaver gnome-user-guide gvfs-fuse hal-cups-utils hplip im-switch jockey-gtk landscape-client laptop-detect libdeskbar-tracker libgl1-mesa-dri libnss-mdns libpam-gnome-keyring linux-headers-generic make min12xxw mousetweaks nautilus-share network-manager-gnome onboard openoffice.org-calc openoffice.org-gnome openoffice.org-impress openoffice.org-writer pidgin pidgin-otr powernowd pulseaudio-module-gconf pulseaudio-module-hal pulseaudio-module-x11 pxljr rhythmbox scim scim-bridge-agent scim-bridge-client-gtk scim-gtk2-immodule sound-juicer splix tomboy totem totem-mozilla tracker tracker-search-tool transmission-gtk ttf-arabeyes ttf-arphic-uming ttf-indic-fonts-core ttf-kochi-gothic ttf-kochi-mincho ttf-lao ttf-malayalam-fonts ttf-thai-tlwg ttf-unfonts-core ubufox ubuntu-docs vinagre vino wodim wvdial xcursor-themes xdg-utils xsane





Wednesday, 8 July 2009

How to Change your Ubuntu Festiy to Hardy or Jaunty Ubuntu Repository?

Hi,

I faced the same as i was unable to update any software and faced like bellow error,

root@eOdissa-desktop:/home/amaresh# apt-get install update
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package update
Solution for this:--

  1. Anyway, here it is, for you to download the source.list. You might want to open it in a text editor, so it doesn’t open Synaptic for you. This list uses the Norwegian mirrors. Just add from “3rd party repos” and down.
  2. then do "gedit /etc/apt/source.list"
  3. replace the content of source.list with downloaded file
  4. reboot the system
  5. goto System --> Administration --> Software source ; then click all check post and change the repository to "main server"
  6. wait for upgrading ...
  7. It will like bellow...
Command Line Interface

Just add the following lines to your /etc/apt/sources.list :

For Ubuntu 9.04 (Jaunty Jackalope):
deb http://archive.ubuntu.com/ubuntu jaunty-backports main universe multiverse restricted

For Ubuntu 8.10 (Intrepid Ibex):
deb http://archive.ubuntu.com/ubuntu intrepid-backports main universe multiverse restricted

For Ubuntu 8.04 (Hardy Heron):
deb http://archive.ubuntu.com/ubuntu hardy-backports main universe multiverse restricted

For Ubuntu 6.06 (Dapper Drake):
deb http://archive.ubuntu.com/ubuntu dapper-backports main universe multiverse restricted

After refreshing the package manager's cache, packages from the backport repositories will now be available for installation.


Go to System > Administration > Software Sources


Then, make sure the main, universe, restricted, and multiverse sources are all checked (or ticked). In most cases, you will not need the source code or CD-ROM/DVD sources.

I believe in Ubuntu 9.04 these should be all checked by default.

You should also choose to download from your country's server in the Download from section. This puts a little less strain on the main Canonical servers.

Next, click on the Third-Party Software tab and click Add


In the APT line paste in

deb http://packages.medibuntu.org/ jaunty free non-free
if you're using Ubuntu 9.04.

For Ubuntu 8.10, you should substitute intrepid for jaunty
For Ubuntu 8.04, you should substitute hardy for jaunty

Then click Add Source


Click the Close button (next to Revert at the lower-right-hand corner). You'll be prompted to Reload. Go ahead and do so.


Some information will then be downloaded letting your Ubuntu installation know what new software is available for installation.

You will get an error message saying that the public key isn't available for the Medibuntu repositories. That's okay. We're about to fix that.


Go to System > Administration > Synaptic Package Manager


When Synaptic Package Manager opens, click on Search at the top-right corner and when the Find dialogue box appears, search for the word medibuntu and then click Search.


When you find the medibuntu-keyring package in the results, right-click it and select Mark for Installation. Then click Mark again to confirm.


Then click Apply and Apply again to confirm.


Once the keyring is installed,

More about repositories

So what are all of these different repositories anyway? Ubuntu Linux has a commitment to open source software, and so for mainly philosophical (and secondarily sometimes legal) reasons, it doesn't include a lot of proprietary software by default. The Ubuntu development team also can offer full support for only the official Ubuntu repositories (Main and Restricted).

You can read on the Ubuntu website more in-depth descriptions of the different types of repositories. Here's a quick low-down, though:

  • Main: Freely licensed software that's officially supported.
  • Restricted: Not exactly freely licensed software that is pretty essential to getting a lot of popular configurations working.
  • Universe: A lot of freely licensed software that's packaged by the community and not officially supported.
  • Multiverse: Not freely licensed software, also put together by the Ubuntu community and not officially supported.
  • Medibuntu: Software not included in the other repositories for various reasons.
There is also a volunteer group that puts together a lot of .deb packages for software not in the repositories or of newer versions than are currently in the repositories. Their software can be found at GetDeb.

Source:--

Thursday, 25 June 2009

Unix Interview Questions and Answers!!!



1. You need to see the last fifteen lines of the files dog, cat and horse. What command should you use?
tail -15 dog cat horse
The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.
2. Who owns the data dictionary?
The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.
3. You routinely compress old log files. You now need to examine a log from two months ago. In order to view its contents without first having to decompress it, use the _________ utility.
zcat
The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.
4. You suspect that you have two commands with the same name as the command is not producing the expected results. What command can you use to determine the location of the command being run?
which
The which command searches your path until it finds a command that matches the command you are looking for and displays its full path.
5. You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose.
whatis
The whatis command displays a summary line from the man page for the specified command.
6. You wish to create a link to the /data directory in bob’s home directory so you issue the command ln /data /home/bob/datalink but the command fails. What option should you use in this command line to be successful.
Use the -F option
In order to create a link to a directory you must use the -F option.
7. When you issue the command ls -l, the first character of the resulting display represents the file’s ___________.
type
The first character of the permission block designates the type of file that is being displayed.
8. What utility can you use to show a dynamic listing of running processes? __________
top
The top utility shows a listing of all running processes that is dynamically updated.
9. Where is standard output usually directed?
to the screen or display
By default, your shell directs standard output to your screen or display.
10. You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type?
tar xf MyBackup.tar memo.ben
This command uses the x switch to extract a file. Here the file memo.ben will be restored from the tarfile MyBackup.tar.
11. You need to view the contents of the tarfile called MyBackup.tar. What command would you use?
tar tf MyBackup.tar
The t switch tells tar to display the contents and the f modifier specifies which file to examine.
12. You want to create a compressed backup of the users’ home directories. What utility should you use?
tar
You can use the z modifier with tar to compress your archive at the same time as creating it.
13. What daemon is responsible for tracking events on your system?
syslogd
The syslogd daemon is responsible for tracking system information and saving it to specified log files.
14. You have a file called phonenos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long?
split
The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.
15. You would like to temporarily change your command line editor to be vi. What command should you type to change it?
set -o vi
The set command is used to assign environment variables. In this case, you are instructing your shell to assign vi as your command line editor. However, once you log off and log back in you will return to the previously defined command line editor.
16. What account is created when you install Linux?
root
Whenever you install Linux, only one user account is created. This is the superuser account also known as root.
17. What command should you use to check the number of files and disk space used and each user’s defined quotas?
repquota
The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.



Thanks,
-Amar

Thursday, 28 May 2009

How to edit Grub loader?


GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which allows a user to have several different operating systems on their computer at once, and to choose which one to run when the computer starts. GRUB can be used to select from different kernel images available on a particular operating system's partitions, as well as to pass boot-time parameters to such kernels.

GRUB is dynamically configurable; it loads its configuration at startup, allowing boot-time changes such as selecting different kernels or initial RAM disks. To this end, GRUB provides a simple, bash-like, command line interface which lets users write new boot sequences.

GRUB is highly portable. It supports multiple executable formats, and is geometry translation independent; while Multiboot compliant, it supports non-multiboot operating systems such as Microsoft Windows and OS/2 via a chain loading function. GRUB supports all commonly used Unix file systems as well as VFAT and NTFS as used by Windows, and supports Logical Block Address (LBA) mode. GRUB allows users to view the contents of files on any supported file system.

GRUB can be used with a variety of different user interfaces. Most Linux distributions take advantage of GRUB's support for a graphical interface to provide a customized boot menu with a background image, and occasionally mouse support.[citation needed] GRUB's text interface can be set to use a serial link to provide a remote terminal boot loader access.

GRUB can download operating system images from a network, and can thus support disk-free systems. GRUB supports automatic decompression of OS images prior to booting from them.

GRUB differs from other boot loaders by being able to communicate with a user directly via a GRUB prompt. A GRUB prompt is the stage before GRUB loads an operating system and can be triggered at a text-mode GRUB booting screen (which is controlled by the configuration file "menu.lst" (or "grub.conf": see below)) by pressing the "c" key. A GRUB prompt (similar to bash) can also be obtained by booting GRUB as a stand alone system without an operating system attached or in any GRUB installation with an operating system when the "menu.lst" file is absent. From the GRUB prompt a user can manually select and control booting from any installed operating system by using bash-like commands. To boot an operating system automatically, the appropriate commands are placed in a configuration file called "menu.lst" in a designated subdirectory.

GRUB has a rich set of terminal commands that allow a user at the GRUB prompt to view the partition details of the hard disks, alter a partition setting, re-map the disk order temporarily, boot any user-defined configuration file and to view booting configuration of other boot loaders in file formats GRUB supports. Thus, without prior knowledge of what is installed on a computer one can use GRUB from an external device such as a floppy disk, USB device or a CD-ROM to boot up an installed operating system.

GRUB uses a scrolling screen for selection of operating systems to boot. This means 150 or more booting choices can be controlled by GRUB with ease by adding each to the "menu.lst" configuration file, and selecting one at boot time using the arrow keys.

One boot loader can boot another boot loader by chainloading. GRUB uses the same two to three lines of command sequences to boot any DOS, Windows, Linux, BSD or Solaris system, making it very easy to work with.

Although GNU GRUB can be pre-packaged or retro-built into Unix-like operating systems, there are also specific GRUB implementations for DOS and Windows. GRUB can also be installed as a stand alone system unattached to any operating system. Its implementation requires one file for booting from a CD and two files for booting from a floppy, hard disk or a USB device. These files are available from any Linux Live CD that supports GRUB, making it easily and freely obtainable by computer users.

[edit] Boot process

When a computer is turned on, the computer's BIOS finds the primary bootable device (usually the computer's hard disk) and loads the initial bootstrap program from the master boot record (MBR), the first 512 bytes of the hard disk, and then transfers control to this code.

The MBR contains GRUB stage 1. Given the small size of the MBR, Stage 1 does little more than load the next stage of GRUB (which may reside physically elsewhere on the disk). Stage 1 can either load Stage 2 directly, or it can load stage 1.5: GRUB Stage 1.5 is located in the first 30 kilobytes of hard disk immediately following the MBR. Stage 1.5 loads Stage 2.

When GRUB Stage 2 receives control, it presents an interface where the user can select which operating system to boot. This normally takes the form of a graphical menu, although if this is not available or the user wishes further control, GRUB has its own command prompt, where the user can manually specify the boot parameters. GRUB can also be set to automatically load a particular kernel after a timeout period.

Once boot options have been selected, GRUB loads the selected kernel into memory and passes control on to the kernel, which then continues to start itself. At this stage GRUB can also pass control of the boot process to another loader, using chain loading, for operating systems such as Windows that do not support the Multiboot standard. In this case, copies of the other system's boot programs have been saved by GRUB; instead of a kernel, the other system is loaded as though it had been started from the MBR. This may be yet another boot manager, such as the Microsoft boot menu, allowing further selection of non-Multiboot operating systems. (This behavior is often automatic when modern Linux distributions are installed "on top of" existing Windows systems, allowing the user to retain the original operating system without modification, including systems that contain multiple versions of Windows.)

-----------------------------------------------------------------------------------------
Linux commands for this :-

step 1:- (Move to boot folder)
cd /boot/grub

step 2:- (edit the menu.lst as per your design)

see the grub editor file:-
vim menu.lst (else use gedit )

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,2)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title Ubuntu 8.04.2, kernel 2.6.24-24-generic
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro quiet splash
initrd /boot/initrd.img-2.6.24-24-generic
quiet

title Ubuntu 8.04.2, kernel 2.6.24-24-generic (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro single
initrd /boot/initrd.img-2.6.24-24-generic


title Ubuntu 8.04.2, memtest86+
root (hd0,2)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Amaresh Will we Choose 2nd OS ?:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

Step3:-
-----------
If you want to change time out section:-
--------------------------------------------

By default it will be 10 second if you want to increase to 20 second then just do change 10 to second

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
#timeout 10
timeout 20

If you want to change the color of loader screen:--
---------------------------------------------------

# Pretty colours
#color cyan/blue white/blue

Just uncomment the color and you will get color background!!

change to:-

It will give normal blue background.:-

# Pretty colours
color cyan/blue white/blue

It will give blinking letter with blue background:-

# Pretty colours
color white/blue

If you have multi OS:---
----------------------------
suppose you have two OS i,e Linux and Window and linux is default OS and window is Optional OS ,

example:-

title Ubuntu 8.04.2, kernel 2.6.24-24-generic
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro quiet splash
initrd /boot/initrd.img-2.6.24-24-generic
quiet

title Ubuntu 8.04.2, kernel 2.6.24-24-generic (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro single
initrd /boot/initrd.img-2.6.24-24-generic


title Ubuntu 8.04.2, memtest86+
root (hd0,2)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other Operating System:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1


Do you want to make Window as first loader ?, If so then please follow my bellow

It's dead easy just change the OS position in menu.lst like bellow,

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Will we Choose 2nd OS ?:
root


title Ubuntu 8.04.2, kernel 2.6.24-24-generic
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro quiet splash
initrd /boot/initrd.img-2.6.24-24-generic
quiet

title Ubuntu 8.04.2, kernel 2.6.24-24-generic (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro single
initrd /boot/initrd.img-2.6.24-24-generic


title Ubuntu 8.04.2, memtest86+
root (hd0,2)
kernel /boot/memtest86+.bin
quiet


Some Interesting Stuffs!!:-
---------------------------

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Amaresh!, Choose my OS?:
root

title IndiaStudyChannel.com(Linux)
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro quiet splash
initrd /boot/initrd.img-2.6.24-24-generic
quiet

title IndiaStudyChannel.com (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=4aceaf01-4d11-4d24-82fa-be463fcb6358 ro single
initrd /boot/initrd.img-2.6.24-24-generic


title IndiaStudyChannel.com, memtest86+
root (hd0,2)
kernel /boot/memtest86+.bin
quiet


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title ittipsandtrics.blogspot.com(Windows)
root (hd0,0)
savedefault
makeactive
chainloader +1



It's all about Grub,

Still you need any new option then please do comment! else feel free to give mail.

Thanks & Regards,
-Amaresh Chandra Das
http://www.indiastudychannel.com/projects/ViewProject.aspx?ProjectId=2318

Wednesday, 13 May 2009

tftp SetUP in Linux (U-Buntu)

This is a quick description of how to install and setup a tftp server in Ubuntu.

1. Install tftpd and related packages.

$ sudo apt-get install xinetd tftpd tftp

2. Create /etc/xinetd.d/tftp file and put this entry:

service tftp

{

protocol = udp

port = 69

socket_type = dgram

wait = yes

user = nobody

server = /usr/sbin/in.tftpd

server_args = /tftpboot

disable = no

}

3. Make /tftpboot directory

$ sudo mkdir /tftpboot

$ sudo chmod -R 777 /tftpboot

$ sudo chown -R nobody /tftpboot

4. Start tftpd through xinetd

$ sudo /etc/init.d/xinetd restart

5. Testing. Tranfering file test.txt from 192.168.1.100 (Client using tftp) to 192.168.1.100 (Server 192.168.1.100). Get an example file to transfer (eg. test.txt)

$ touch /tftpboot/test.txt

$ chmod 777 /tftpboot/test.txt

$ ls -l /tftpboot/

total 0

-rwxrwxrwx 1 amaresh amaresh 707 2006-03-27 23:07 test.txt

$ tftp 192.168.1.100

tftp> put test.txt

Sent 722 bytes in 0.0 seconds

tftp> quit

$ ls -l /tftpboot/

total 4

-rwxrwxrwx 1 amaresh amaresh 707 2006-03-27 23:07 test.txt

Thursday, 7 May 2009

Setup tftp server in Ubuntu Linux

This is a quick description of how to install and setup a tftp server in Ubuntu.

1. Install tftpd and related packages.

$ sudo apt-get install xinetd tftpd tftp

2. Create /etc/xinetd.d/tftp file and put this entry:

service tftp

{

protocol = udp

port = 69

socket_type = dgram

wait = yes

user = nobody

server = /usr/sbin/in.tftpd

server_args = /tftpboot

disable = no

}

3. Make /tftpboot directory

$ sudo mkdir /tftpboot

$ sudo chmod -R 777 /tftpboot

$ sudo chown -R nobody /tftpboot

4. Start tftpd through xinetd

$ sudo /etc/init.d/xinetd restart

5. Testing. Tranfering file test.txt from 192.168.1.100 (Client using tftp) to 192.168.1.100 (Server 192.168.1.100). Get an example file to transfer (eg. test.txt)

$ touch /tftpboot/test.txt

$ chmod 777 /tftpboot/test.txt

$ ls -l /tftpboot/

total 0

-rwxrwxrwx 1 amareshcd amareshcd 0 2006-03-27 23:04 test.txt

$ tftp 192.168.1.100

tftp> put test.txt

Sent 722 bytes in 0.0 seconds

tftp> quit

$ ls -l /tftpboot/

total 4

-rwxrwxrwx 1 amareshcd amareshcd 707 2006-03-27 23:07 test.txt

GCC Setup for compiling the Bootloader (Debian Linux)

To compile the bootloader on Ubuntu, follow these steps:
  • check gcc version :-
command :- gcc --version
example:-
amaresh@AmSi:~$ gcc --version
gcc (GCC) 3.3.6 (Ubuntu 1:3.3.6-15ubuntu4)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  • Do following way:-
sudo apt-get install gcc-
sudo rm /usr/bin/gcc
sudo ln /usr/bin/gcc- /use/bin/gcc

Example:-
sudo apt-get install gcc-3.3
        sudo rm /usr/bin/gcc
sudo ln /usr/bin/gcc-3.3 /usr/bin/gcc

Screen Tips (Linux)

Screen is a terminal emulator that allows you to detach/reattach to running programs. This allows you to have many programs running in tabs on one console connection. You can then detach from that instance of screen, logout, go home, login and reattach as if nothing happened.

This makes it significantly easier to have the same working environment over the VPN as you do at your desktop.
Quick Introduction

type: screen

You will be sitting at a bash shell as if nothing changed. However, you are now running bash inside of screen. All commands that are directed at screen are prefixed with Ctrl-a (C-a)

Now, try this: C-a c as in Ctrl-a create new tab.

And then: C-a " as in Ctrl-a (quote)

This should list the two tabs you have open, you can use up and down to move between them.

Launch vim and type some words in the vim session. Now hit: C-a p as in Ctrl-a previous.

Your vim will dissappear and you will be at your first tab again, at a bash prompt.

Now hit: C-a d (Ctrl-a detach) to drop you back to the original command line. Do a quick ps aux | grep screen to see your screen session is still running.

You can actually exit the shell session or completely disconnect from your ssh session (like ssh to blizzard) and your screen will still be there waiting for you.

When you are ready to reconnect to your screen just type: screen -r
Command Overview

Key
Action :- Ctrl-a c
New tab :- Ctrl-a n
Next tab :- Ctrl-a p
Prev tab :- Ctrl-a "

List tabs, interactively choose 1

Ctrl-a Ctrl-a

Goto last tab :- Ctrl-a N
Goto N tab :- Ctrl-a d

Detact from session :- screen -r

Reattach to a session (run from command line) :- screen -d -r

Reattach to a session, detaching an attached session first if necessary (nice if you want to see a running screen state from a different location)
screen -x

Attach to your running session (run from command line). This allows you to have two terminal windows connected to the same screen session (yes, you can watch yourself type)

Ctrl-a A


Rename this tab
Ctrl-a S

Split current tab into two horizontally into regions

Ctrl-a :resize
Resize current region
Ctrl-a tab

Move to next region
Ctrl-a M

Monitor a tab for activity
Ctrl-a _

Monitor a tab for silence
~/.screenrc

Add these lines to your ~/.screenrc for some prettiness:

startup_message off
hardstatus alwayslastline
hardstatus string '%{.k}%{g}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %m/%d %c ]%{W}'


This will stop displaying the welcome message and add a status line across the bottom that lists the host, your open tabs, the servers cpu usage and the current time

Linux Tips & Tricks here

Setup a Disk Drive

*Create a Partition:
o fdisk /dev/(device i.e. sdb)

File system types
o For ext2 use 'mke2fs'

For ext3 use 'mke2fs -j'

For reiserfs use 'mkreiserfs'

For xfs use 'mkfs.xfs'

For jfs use 'mkfs.jfs'

Create a file system (example)
o mke2fs /dev/(device i.e. sdb1)

Activate drive:
o Add entry to /etc/fstab
+ vi /etc/fstab

Mount all devices in fstab
+ mount -a

Note: If unfamiliar with vi, use pico to edit in non visual interface

Mount a Floppy Disk Drive

* mount -t msdos /dev/fd1 /mnt/floppy

(or use ufat instead of msdos)

Search for installed packages

* rpm -qa|grep package (redhat)
* dpkg -qa | grep (Debian Linux)

Remove Installed Package

* rpm -e package (Red Hat)
* dpkg -P package (Debian Linux)
else
apt-get remove package
Managing Most Services

* /etc/init.d

then use command stop i.e. ./Kasenna_Apache stop

Make a link

* ln -s destinationoflink linkname

Check kernel version

* uname -r

Make images of cd-roms or hdd

* dd if=/dev/hda of=/dev/hdc bs=4k block_size

Messages (to other users)

* Send to all
wall message

Send to one user (insert message after
write user

Send to one user on a specific terminal
write user tty1

Compare 2 Source Code Files

* diff -u file1 file2

+ means in #2 not in #1 - means in #1 not in #2

Make software tarball (compression methods)

*

tar -cvf hi.tar *

then

gzip hi.tar

Create md5 check sum

*

md5sum -b boot.gz

Find a file

*

find (dir) -name filename
o

eg. find ./ -name help.txt

find and execute a command on all found files:
o

find (dir) -name (expr) | xargs (command)

Search several text files in several directories

*

grep -r --with-filename 00:00:00:00:00: */mac_table

Get the size of all sub-directories

* du -s *

(use -sk for kilobytes or -sh for human readable)

Send e-mail from console

* echo "Message" | mail -s "subject" recipient1 recipient2 recipient3

Remove first character of line

* cut -c 2-

Remove password on sudo

* in ~/.bash_profile place the line:

export SUDO=sudo

as root run visudo uncomment

%wheel .... no passwords

add users who need passwrodless sudo to wheel group

vi /etc/group

Increase Priority of Process

* nice -n

(pri -20 to 20 where -20 is the fastest or highest priority)

To get files from a ramdisk

* Copy ramdisk to temp dir then:

gunzip ramdisk

mount -o loop -t ext2 ramdisk_img

Get the required files then:

umount

To print a test file from the cli

* lpr filename

To count the number of lines with sed

* sed -n '$=' filename

cat filename | sed -n '$='

Grab One Line out of a Text File

* cat textfile | sed -e 's#\t##g' | sed -n "Line_Number"

Replace one line in a textfile

* sed 10c\\"New_String = -mq${1}" textfile
o

-- Where 10 is the line number

Pull Out String From Line

* echo "inet addr:192.168.145.11 Bcast:192.168.145.255" |sed -e 's/[^i]*inet addr:\([0-9.]*\).*/\1/p'

Redirect Command output

* Redirect Standard to Null

* command > /dev/null
Redirect All Standard to Null

command &> /dev/null

Redirect Errors to Same Location as Standard

command > /dev/null 2>&1

Redirect Errors to Null

command 2> /dev/null

Redirect Standard to File

Just replace "/dev/null" with filename

-- use '>>' to append file instead of overwrite '>'

Use vi in split screen mode

* Enter split screen

* :split
o

Open new file

:e path/filename
o

Switch to Upper Window

ctnl+w k
o

Switch to Lower Window

ctnl+w j

Create a cron job entry

*

Run the crontab editor

crontab -e

Then add entry

Example crontab

*

A decent cron template. Remove commands or add commands as needed (was used for Gentoo so emerge commands will not be valid on a non-Gentoo rig)

#!/bin/sh
cdmailto=me
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:$HOME/bin
# minute (0-59),
# | hour (0-23),
# | | day of the month (1-31),
# | | | month of the year (1-12),
# | | | | day of the week (0-6 with 0=Sunday).
# | | | | | commands

# ------{ default cron crap }---------- #
0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
1 3 * * * rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
*/10 * * * * /usr/bin/test -x /usr/sbin/run-crons && /usr/sbin/run-crons
# ------{ daily cron jobs }------------ #
0 1 * * * emerge sync >/dev/null 2>&1
0 2 * * * /backup/backup.sh
40 1 * * * emerge -uDpv world >/home/ben/Reports/emerge.txt
0 3 * * * updatedb && eupdatedb >/dev/null 2>&1
0 4 * * * glsa-check -l | grep '\[N\]'
# ------{ weekly cron jobs }----------- #
15 7 * * 0 makewhatis
0 7 * * 1 fc-cache -fv
0 4 * * 2 tar -cvzf /backup/weekly-backup.tgz /backup/weekly/*
10 4 * * 3 rsync -v -a --delete /backup/weekly-backup.tgz /mnt/nfs/backup/weekly-backup.tgz
# ------{ bi-weekly & monthly jobs }--- #
"

Links

http://www.acck.edu/~jerod/spellbook.html
Boot into single user mode

1. On boot up get to the grub menu 2. press 'e' to edit your boot parameters 3. add "init=/bin/sh" to the list of kernel parameters 4. save and then boot off that modified selection 5. you will now have root access in singl user mode