Tips n Tricks for Linux

Status
Not open for further replies.

ujjwal

Padawan
Keeping track of packages installed from source

Installing software from its source code is the optimal way of installing software in linux. Unfortunately, uninstalling these softwares can be a bit of trouble, as you have to go hunting through /usr/local/ for all the files created during the "make install" procedure.

Well, there is an easy way around that. Use this nifty tool called checkinstall for that purpose.

When make install is done, CheckInstall will create a Slackware, RPM or Debian compatible package and install it with Slackware's installpkg, "rpm -i" or Debian's "dpkg -i" as appropriate, so you can view it's contents with pkgtool ("rpm -ql" for RPM users or "dpkg -l" for Debian) or remove it with removepkg ("rpm -e"|"dpkg -r"). Aditionally, this script will leave you a copy of the installed package in the source directory so you can install it wherever you want.

So, compiling a software once will give you a package that you can install/uninstall at will, and you don't need to compile the program all over again when you reformat :)
 

nixcraft

Journeyman
I have some tips @ myblog mostly useful for admins *www.cyberciti.biz/nixcraft/vivek/blogger/linux-tips-and-tricks.php :D
 

surdy

Broken In
for those who have a dual boot machine ..... To access(read-only) linux partitons from Windows use EXT2IFS here is the link *uranus.it.swin.edu.au/~jn/linux/ext2ifs.htm

P.S. Only for Microsoft Windows NT 4.0, Microsoft Windows 2000 (NT 5.0) and Microsoft Windows XP (NT 5.1).
 

ujjwal

Padawan
Mounting your windows partitions with specific permissions

I guess you know how to auto mount your windows partitions in linux. If not, then you can do it by adding a line like

/dev/hda1 /mnt/dos/d vfat defaults 0 0

to your /etc/fstab file. See the "Fedora Core 3 FAQ" for more details (it applies to any distro).

But by default, your FAT partitions are mounted with permissions such that only root can access them, and not normal users. You can get around this by using "umask".

For example, replace "defaults" in the given line with "umask=022" such that the root user has write access to all files in that partition, and everyone else can only read the files.

Read up on linux file system permissions (man chmod & man umask) to experiment with the permissions to get them to your liking :)
 

pradeep_chauhan

Cyborg Agent
quick logoff ctrl+alt+ backspace


sorry thats a bad way to kill the x server and not a loggoff as your loggin is still active in init level 1,2 or 3.
 

ujjwal

Padawan
Taking screenshots using simple command line tools

Sure, its simple to use The Gimp or KSnapshot to take linux screenshots, but many a time one may not want to use these heavy and cumbersome tools for a simple thing.

Make sure you have ImageMagick installed (its a versatile console based image manipulation toolset), else get it from *www.imagemagick.org/

Now, you can use the command

import -window root screen.jpg

You can also specify a single windows of which to capture an image (root captures whole screen)

To view the image, type

display screen.jpg

Timed screenshots

Now for the fun part, we shall use the sleep command to get the screenshot after a small delay, so that we can arrange the screen the way we like ;)

sleep 5 ; import -window root screen2.jpg

This statement will first execute "sleep", so it will go idle for 5 seconds, in which you can do what you like, and then execute "import" to capture your screen.

Also, Captura is a simple tool to get screenshots, and it is vert easy to use

*www.hernansoft.com/downloads_en.html
 

amol_dan

Right off the assembly line
Booting Linux with NTOS boot loader

For all those who do not want to install both windows and linux but do not want to overwrite their windows MBR.

This trick can help a bit provided you have windows 2k or XP

When installing linux, choose to install boot loader on the root partition or /boot partition(if any).

When you boot into linux mount your windows C drive to some directory e.g. /mnt/C

Launch a terminal, su to root, change to the directory where C drive is mounted.

Type this command.

dd if=/dev/<drive where boot loader is istalled> of=bootsect.lnx bs=512 count=1

e.g.

dd if=/dev/hda3 of=bootsect.lnx bs=512 count=1

Then come back to windows.

Add this line to boot.ini file

C:\BOOTSECT.LNX="<Your distribution name>"
 

ujjwal

Padawan
Ok here is a neat trick I found at the arch forums.

We know that linux filesystems handle data operations well so there is no need of defragmentation. But when there is frequent writing to a certain directory the data may get fragmented. A common example is the database used by a package manager (pacman, apt-get, slapt-get, emerge, yum etc). This may cause accessing data to be slow, and (in this case), querying the package manager will take time.

But there is an easy way to rearrange the data so that its all in one place.

Say, the directory is called "blimp".

Code:
cp -r blimp blimp2
rm -r blimp
mv blimp2 blimp

So as you can see, a fresh copy of the directory is created, and the newly created files are not fragmented. The old (fragmented) directory is removed, and the new one is renamed to the name of the old directory.

Credit goes to *bbs.archlinux.org/viewtopic.php?t=11840 :D
 

banned2wise

Broken In
Intro for linux uploaded @ rapidshare.de
==> Download here <==

100 tips and tricks(common) for linux uploaded @ rapidshare.de
==> Download here <==
 

banned2wise

Broken In
The Linux Documentation Project Archive
Code:
*www.tldp.org/linuxfocus/English/Archives/index.html

Its very useful for newbies like me.
 

banned2wise

Broken In
Source


Question:
I have Red Hat 9, and it's XMMS player don' t want to play mp3'z. At first time it showed some message, that this player doesn't support mp3 for some reazon.

Answer:
www.freshrpms.net search around quicker if you click here


This is a common question many ppl tend to ask @ the forums.

Courtesy : LQ Forums
 

banned2wise

Broken In
To clear history in the bash shell type
Code:
[root@localhost root] $ history -c

I also suggest linux users and mods to be active this thread by posting a command a day ..... Newbies will find it useful(count me in tooo)
 

ujjwal

Padawan
Some ways to search for files -

1. Locate

A database of all files present in your system is maintained in a GNU/Linux system, this makes it easy to locate a file when you need it.

Code:
locate filename

However, this will show only those files which were present on your system the last the database was updated, to update the database, run as root -

Code:
updatedb

2. Find

find will search an area of the filesystem for a file you need. It is slower, but its a surer way to get your files.

Code:
find /directory/to/search -name filename

The basics of vi

vi is a very handy text editor, and many a times it is all one has to edit a file from console. Knowing its basics can be helpful.

By default when you start vi (vi <filename>), you are in "command" mode, and you can't write something yet. Hit to enter insert mode, and <ESC> to exit from it. In command mode, <x> will delete a charactor and <dd> will delete a line. Hit ':' (shift + ';' key) to get a prompt, from where you can type 'w' to save, 'q' to quit, 'wq' to save, 'q!' to quit without saving.

There are full books on vi, but this is just a very basic intro to just explain what is needed to edit files with it.

REQUEST : If anybody has a few good tips on using the samba client (smbclient) that will be very helpful.
 

ujjwal

Padawan
If someone wants to try out downloaded knoppix based live linux cd's, without burning them to a CD, this is a good way, which uses the DOS based loadlin tool. This one is intended for Damn Small Linux, but should work for all knoppix based distro's. I tried it and it works beautifully.

*www.damnsmalllinux.org/talk/node/191
 

banned2wise

Broken In
Loadlin for dsl page :)
I really should say, cool ....

Samba config, ebook.... Please check whether it covers what u wanted ...
Code:
Configuring Samba ==> *rapidshare.de/files/2631299/Samba_configuration.pdf.html
 

GNUrag

FooBar Guy
Navigating quickly in bash

1) Press CTRL - L to clear your screen immediately (better than entering "clear" command everytime)

2) Press CTRL - K to cut the characters from the cursor till the end of a line

3) Press CTRL - U to cut the characters from the cursor till the starting of a line

4) Press CTRL - Y to paste the characters that you have cut just now.
 

mario_pant

In the zone
*www.thinkdigit.com/forum/viewtopic.php?t=24162

someone please help me!!....

how do i restore windows without any data loss..... GRUB just wont load my windows.......
 
Status
Not open for further replies.
Top Bottom