Put your GNU/Linux tips here 
Be sure to put a descriptive title when making your post, and only put one tip per post so the box on the frontpage works well.
Tip collection
I take it this thread is for posting various useful tips? That's a great idea. In that case it can be stickified. 
Oh.. I'll have to throw a tip out of my hat then...
Okay, I've got one. I'm not sure how many people may find it useful, but there might be some. I know I could've known it sooner.
If you want to make an application connect to the internet through a proxy of any kind, but that application does not have a built in option for selecting a proxy you can use a nice and small utility called "tsocks" (which you should be able to find in a package database of any distro). What you need to do is just create or modify an /etc/tsocks.conf file and enter the following into it:
server = 127.0.0.1 # put the address of your proxy instead of this
server_port = 9202 # put the port of your proxy here
The example above is what I use for my satelite ADSL proxy so I can have a downstream via satelite.
After you've modified /etc/tsocks.conf it's just a matter of starting an application with the tsocks command precluded to have that application go through the proxy. This way, tsocks wraps that application forcing it to use the proxy.
For example, to start an FTP client krusader (which doesn't have a built in proxy option) just run a command like this:
tsocks krusader
That's it. It's extremely useful for me, and if you have to be behind a proxy I bet it could be for you too.
Cheers
Daniel
Spell checking in the command line
If you want to spell check that text file you've been writing in nano or vim, th
en ispell file and it'll give you suggestions for miss-spelt words,
which you choose by typing the number next to them.
What if I want to check TeX or LaTeX files?
If so use the -t flag ispell -t file.tex
What if I want to check a nroff/troff file?
If so use the -n flag ispell -n file
What if I want to check a HTML or SGML file?
If so use the -H flag ispell -H file.html
What if I don't want an English dictionary?
If you want to choose another dictionary, use the -d flag. If you want the German dictionary on a German install: ispell -d deutsch file
Awesome tip dylunio.
As for one myself, if you're going to put any PNGs on the web, squash them down, file-size wise. Grab yourself a package called 'pngcrush'. It's in Ubuntu universe if I recall correctly and has on many occassion reduced a 200 kb PNG file down to 120 kb, if not lower.
$ pngcrush -reduce inputfile.png outputfile.png
This is uses the common compression algorithms. There are about ten of them and the pngcrush squashes the PNG with the one of those ten that reaches the lowest file size.
$ pngcrush -reduce -brute inputfile.png outputfile.png
Brute crush. Here pngcrush goes through about 113 different algorithms, and then uses the one which achieves the highest compression. This naturally takes a lot longer and could potentially occupy your processor for some time. I find it worth the extra time. To squash a 1600x1200 ~ 1 MB PNG file it takes about 3-4 minutes.
pngcrush works by trying to locate large areas of similar colours. Files which feature a lot of one or two colours work really well with pngcrush. Therefore, if you were to squash an exported PNG from an Inkscape work you've done which features about 10 different colours you would achieve a much better result than a photograph in PNG format, even if it were the same file size as the Inkscape export or same resolution, because the photograph would feature easily several hundred thousand colours, if not a million. :smiling:
Read the Gentoo Handbook, even if you never install Gentoo. It'll teach you how to do things manually in the event of automated programs failing.
Great tips so far! Here's another one.
If you use any of the debian, RPM (RedHat) or Slackware based distros, you can use checkinstall to easily make packages from source. It is braindead easy. After you've done ./configure and make, instead of doing "make install" you run "checkinstall -y" which will, instead of installing the built software directly to the system (without being registered by the package manager) make a package (deb, rpm or slackware tgz) and install that package through a native package manager. You just have to select the package type native to your distro (e.g. if it's slackware you say "S" when it asks you this).
So..
$ ./configure $ make $ su (enter password) # checkinstall -y (choose package type) (done)
The benefit of this is having a more seamless control over what you installed from source and as well being able to easily uninstall it using the package manager.
Try sshfs, it's incredibly useful. All that is required on the server is a running ssh daemon.
for example with sshfs you can
- manage files on the server with your favourite file manager
- edit your webpage in your favourite editor without having to download and upload it (well, technically, sshfs does that for you)
I created a directory /home/me/mnt . Inside those directory are directories for each server that I regularly need to access.
To mount a remote filesystem, use
sshfs user@server:directory mountpoint
user defaults to your local username, directory defaults to the home directory of the remote user. So
sshfs
:/ /home/me/mnt/nuxified
mounts / on nuxified.org as /home/me/mnt/nuxified
and (don't miss the : !!!)
sshfs nuxified.org: /home/me/mnt/nuxified
mounts /home/me on nuxified.org as /home/me/mnt/nuxified
To unmount, use
fusermount -u mountpoint
eg
fusermount -u /home/me/mnt/nuxified
Sounds awesome, though it requires that I have ssh access rights to the server.
Those are far more common than nfs access.
There is a similar filesystem for ftp: fuseftp. It seems there were some problems with the aur when I tried to build that one on archlinux, so I can't tell you anything about it except that it will be more or less the same.
Also, I don't have ftp access to anything anywhere, so I wouldn't be able to test it.
Finally, I think ftp is scary, just like telnet, sending unencrypted passwords... :smt105
How to free up space in Gentoo
Gentoo can use up a lot of space due to it's package management system portage.
A good way of cleaning things up is to clean unfinnished or unsucessful emerges, and remove the dowloaded tarballs.
So here we go: rm -rf /var/tmp/* this gets rid of /var/tmp/portage (which contains the cruft of emerges) as well as a few temperory odds and ends.
And: rm -rf /usr/portage/distfiles this gets rid of tarballs portage downloads - which can take up a fair bit of space.
Cleaning up script
I have the following script run on reboot to clean out temperory files and portage cruft:
And the crontab line is: @reboot cleanup.sh
dylunio
I like a minimal desktop which includes small icons. If you would like 16x16 icons pretty much desktop wide add the following to your ~/gtkrc-2.0 file. Cheers to AndyFitz for originally telling me this. :smiling:
gtk-icon-sizes="gtk-menu=16,16:\ gtk-button=12,12:\ gtk-small-toolbar=16,16:\ gtk-large-toolbar=16,16:\ gtk-dnd=32,32:\ panel-menu=16,16:\ panel=16,16:\ gtk-dialog=22,22" gtk-toolbar-icon-size=large-toolbar gtk-icon-size = "gtk-button=16,16"
Great reference for Bash scripting and other Bash things:
http://www.gnu.org/software/bash/manual/bashref.html
Customize your Bash prompt:
http://www.gnu.org/software/bash/manual/bashref#SEC83
Tar has builtin support for multivolume archives. To create them:
tar -cML (size of drive you're using in KB) -f /place/device/is/mounted/(name of archive).tar (files to be archived)
When tar prompts you to prepare for the next device, umount the device you're saving the archive to (and wait until it finishes, don't Ctrl+C it!) and take it out. Take the device to some other computer (perferably not a windows-running one, windows mounts things sync) and copy the part of the archive on the device to the computer's hard drive. Go back to the computer you're backing up, mount the device, go to tar and hit enter. Repeat until tar finishes.
To extract this multivolume archive:
tar -xMf (part 1 of archive) -f (part 2 of archive) and on for the rest of the parts
To execute multiple commands which need their preceeding command executed successfully seperate them with &&
Example:
./configure && make && make install
make will only be started when configure had no error and make install will only be run if there was no error during compilation.
The fish kioslave is like sshfs, but easier. First you have to have ssh set up. Now you can use fish from any KDE application. Just enter fish://USER@HOST/file/name/on/the/host/ (note: You can't use ~ instead of a home directory here) as the filepath and enter your SSH password in the dialog. I use this to manipulate my website from Quanta on my PC, using fish://www@marvin/var/www/.
I think it would be a good idea to post tips in a blog instead in a forum, from now on. The only requirement to make it organized would be to type "tips" tag in a categories section of your blog submission and then it would automatically be listed on a page with all other tips that would be linked from the main horizontal menu.
In a blogs view I think they'd look better than in a long forum thread and every tip would be possible to comment and discuss on specifically, possibly leading to some new related tips.
What do you think? Shall we continue tips there? If yes, just please remember to type "tips" in a category section of your blog submission.
Thank you
Cool, maybe it's best to make a special blog entry in a tips category that links to this thread so that these tips aren't lost, and then move on from there.
Then this thread can be locked and it's original and last post edited with the link to the new tips section.

















Joined: 2005-12-20