Libervis Network - For a Free WorldLibervis.com :: Planet Libervis :: Nuxified.org :: MobiLiberty.com  |  IRC | powered by shopcentar.hr

Tip collection

 Submitted by a thing on Tue, 2006-01-31 05:16.  
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Put your GNU/Linux tips here Smiling
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.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Tue, 2006-01-31 18:45  tsocks for wrapping apps to proxy
libervisco's picture
Administrator
Posts: 3783
Joined: 2006-05-04

I take it this thread is for posting various useful tips? That's a great idea. In that case it can be stickified. Smiling

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



 Thu, 2006-02-16 21:52  Command Line Spell Checking
dylunio's picture
Writers Team
Posts: 549
Joined: 2005-12-20

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

--

Yn falch o ddefnyddio Linux a FLOSS!



 Fri, 2006-02-17 03:36  reduce png size with pngcrush
Posts: 133
Joined: 2005-12-21

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:

--

*Kaffee und Kuchen*



 Fri, 2006-02-17 03:54  optimize PNGs with OptiPNG
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

OptiPNG with -o 7 slightly better than PNGCrush with -brute.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

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.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



libervisco's picture
Administrator
Posts: 3783
Joined: 2006-05-04

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.



a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Or you can use the GNU Source Installer.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Fri, 2006-03-03 09:11  power of sshfs
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

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

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Sat, 2006-03-04 10:15  fuseftp
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21
libervisco wrote:

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

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Sat, 2006-03-04 16:48  Freeing up space in Gentoo
dylunio's picture
Writers Team
Posts: 549
Joined: 2005-12-20

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:

Quote:

#!/bin/bash

for dirs in /usr/portage/distfiles/* /var/tmp/* /tmp/* ; do

rm -rf $dirs

done

And the crontab line is: @reboot cleanup.sh

dylunio

--

Yn falch o ddefnyddio Linux a FLOSS!



 Tue, 2006-03-14 00:23  Don't cat binaries
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Don't use cat on binaries, it will screw up the console. But you can use strings to find strings in binaries.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Tue, 2006-03-14 00:26  mount USB drives async
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Mount USB drives async, it makes it WAAAY faster.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Tue, 2006-03-14 00:26  Tweaking KDE
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

If you want to tweak something in a KDE application that's not in the settings dialog, look in ~/.kde/share/config/APPNAMErc and ~/.kde/share/apps/APPNAME/.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Tue, 2006-03-14 06:36  16x icons for the GNOME desktop
Posts: 133
Joined: 2005-12-21

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"
--

*Kaffee und Kuchen*



 Sun, 2006-03-26 20:41  Starting out with Vim
dylunio's picture
Writers Team
Posts: 549
Joined: 2005-12-20

Starting out with Vim

If you want to use the Vim editor, don't just barge in and try to use it, firlstly go through the Vim tutor: vimtutor

dylunio

--

Yn falch o ddefnyddio Linux a FLOSS!



 Fri, 2006-03-31 20:10  Human readable filesizes
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

For human readable filesizes put this in /etc/profile:
alias ls="ls -h"
alias du="du -h"
alias df="df -h"

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Fri, 2006-03-31 20:11  Coloring ls'ed files
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

For coloring files depending on their type, put this in /etc/profile:
alias ls="ls --color=always"

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Fri, 2006-03-31 20:11  Finding size of a directory
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Space a directory uses:
du -s

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Fri, 2006-03-31 20:11  Great Bash reference
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Great reference for Bash scripting and other Bash things:
http://www.gnu.org/software/bash/manual/bashref.html

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Fri, 2006-03-31 20:12  Customize your Bash prompt
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Customize your Bash prompt:
http://www.gnu.org/software/bash/manual/bashref#SEC83

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Fri, 2006-03-31 20:12  Multivolume tar archives
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

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

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Fri, 2006-03-31 21:44  Multiple commands on the same line
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

Put multiple commands on the same line by separating them with a semicolon ( ; ).

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



Posts: 721
Joined: 2006-03-28

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.



dylunio's picture
Writers Team
Posts: 549
Joined: 2005-12-20

To execute a command only if the previous command doesn't succeed use ||

emerge --sync || echo "Error in syncing"

If the emerge --sync doesn't work the echo command will be invoked.

--

Yn falch o ddefnyddio Linux a FLOSS!



 Thu, 2006-05-18 18:45  fish kioslave
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

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/.

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Thu, 2006-05-18 18:46  Tips to blog
libervisco's picture
Administrator
Posts: 3783
Joined: 2006-05-04

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



 Thu, 2006-05-18 18:49  Good idea
a thing's picture
Moderator
Posts: 828
Joined: 2005-12-20

I like it Smiling

--

Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
idontknowctmwhatsthepointofcapitallettersorspacesorpunctuation



 Thu, 2006-05-18 18:59  Cool, maybe it's best to
libervisco's picture
Administrator
Posts: 3783
Joined: 2006-05-04

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.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

We have 1623 members who wrote 1961 articles and 11460 comments. Welcome to our newest member, Prancegymnary!

Who's online

There are currently 0 users and 5 guests online.
About | FAQ | Goodies | Link | Contact | IRC
Nuxified RSS feed
Welcome >  |  Need help? Register here and ask away! | Show what's new