More Linux tips every geek should know

LXF

If you've already read and memorised our "Linux tips every geek should know" and "20 all-new tips for KDE 4.2" features, we've picked out 50 more Linux desktop tips for you to enjoy.

And remember, if you don't ask, you don't get - follow us on Identi.ca or Twitter to have your say on what we post next...

Command line

#1: Auto-correct typos

Typing on the command line isn't easy. First, it takes a lot of time to learn how all the commands work, but then even after that you need to be very precise with your file and directory names, otherwise you'll need to try and try again.

But there's a way out: Bash has a built-in command called "shopt" that lets you set various command-line options. For example, running shopt -s cdspell enables automatic typo correction for directory names, so that typing cd /hom/hudzila will get you to the nearest match - /home/hudzilla.

You can also use shopt -s nocaseglob so that when you type part of a filename and press Tab to autocomplete, Bash does a case-insensitive search.

#2: Sequential command history

Apparently computers are here to make life easier, but that's news to us - all too often we find people executing the same boring repetitive sequence of commands to get a job done, rather than think a little smarter and really flex the full power of Bash.

For example, if you want to run the last three commands repeatedly, just scroll up to the first one in the sequence, hold down the Control key and tap O as many times as you need. Each time you tap O, one command in the sequence will be executed, and when it hits the last command it goes back to the first one you selected and repeats.

#3: Make working as root safer

Working with root is either great fun or extremely dangerous, depending on how much you like the feeling of supreme executive power.

But if you're one of the people who fears the mighty power of the superuser to delete files with impunity, what you need is chattr: it lets you set a file as being immutable, which means that not even root can delete it. For example: running chattr +i myfile.txt as root will make that file virtually indestructable no matter what user you are. If you want to remove the shield of steel, use -i rather than +i.

#4: Selective deletion

If you have a directory that contains ten subdirectories and you want to delete three of them, the slow way to do it would be like this:

rm -rf /home/hudzilla/work
rm -rf /home/hudzilla/projects
rm -rf /home/hudzilla/sandbox

But that's pretty darn slow and open to making mistakes - a much smarter way to is to let Bash perform multiple filename expansion by placing the options inside braces. For example, this would achieve the same as the three lines from above:

rm -rf /home/hudzilla/{work,projects,sandbox}

#5: Locate with style

Everyone loves the locate command, because as long as your index is up-to-date, there is no faster way to find files matching a certain name. Of course, the problem with locate is that it just lists filenames, which is no good if you want more information on those files, such as how much space they take up.

Well, why not try piping the output from locate through ls? For example, this neat little one-liner will find files matching somefile, then pipe that list through ls -lsh so you'll see all the matching results as well as how big they are on your system:

locate somefile | xargs ls -lsh

#6: Silence the beeps

Sick of your computer speaker beeping like a demented Morse code machine whenever you type something wrongly? Teach it the sound of silence: run the command setterm -blength 0 to mute the alarm bell no matter what kind of terminal you're typing into. If you want it to happen every time you start a terminal, just add the command to your .bash_profile file.

If you just want to get rid of error messages completely, redirect the standard error stream to the pseudo-device /dev/null using the notation 2> /dev/null. Here's an example using the find command:

$ find / -user chris 2> /dev/null

#7: Cutting text

Awk is a powerful beast for extracting information from lines of text, often far more than is needed. The cut command does the same sort of thing more easily.

cut -c1-10

returns the first ten characters from each line of standard input, while

cut -f 3 -d ' '

returns the third field, where the delimiter for a field is set to a space by -d, so it returns the third word. Cut has more options, but all are simple to use.

#8: Checking your aliases

Some distros ship with a wide selection of aliases, with SUSE often leading the pack. If you want to find out just what Bash is up to behind your back, you can query your aliases by using the type command, like this: type -all ls - that will ask Bash to list precisely what it considers ls to be, and you'll probably find that ls is aliased to something like ls --color=auto and of course also that it lives as a real program in /bin/ls.

Alternatively, if these colours annoy you you can turn them off quite easily. To turn it off for one specific shell, type the command unalias ls. To turn it off permanently, just add that command to the .bashrc file in your home directory, so that all your bash shells will see it as they start up and not blind you with garish colour.

#9: Get at a DVD virtually

Sometimes even Linux Format's magical powers can't squeeze every distro onto a disc in bootable format, which means that sometimes we need to give you ISO files containing the latest and greatest.

These ISOs are great if you have a CD burner and want to install the distro sharpish; however, sometimes you just want to nab a few of the snazzier looking wallpapers (Fedora Core 7's balloons, anyone?), in which case your best bet is to mount the ISO as a filesystem, then copy off whatever you want, like this:

mkdir /mnt/myiso
mount -o loop -t iso9660 some.iso /mnt/myiso

#10: Instant spelling suggestions

Looking to reject the GUI life altogether and restrict yourself to the command line like a real Unix geek? Great! But as soon as you miss the OOo spellchecker, don't fret: most Linux systems come with the look command built-in, which is a command-line spellchecker. To get started, type look followed by part of a word:

look separ 

should show you matches like "separate", "separately", and so on, whereas entering:

look seper 

will show nothing, because "seperate" is a mis-spelling.

#11: Add colourful prompts

Do you live life on the command line, but often forget which terminal is your local box and which is SSH'd into your critical server? There are a number of fixes for this - chiefly, don't be an idiot and look where you are typing first. You might also want to use a different virtual desktop for SSH sessions.

But perhaps the easiest, most obvious way is to change the terminal prompt. Default prompts on unix systems are usually grey or white on a black background, or sometimes the reverse. How much more obvious can it be that you are somewhere else if your prompt is entirely different, like maybe flashing bold red with some warnings?

The prompt for almost all shells is included in the PS1 system variable, so we just need to change that to change the prompt. try the following:

export PS1="\e[48;34m \u@\H:\W\e[m>\$ "

You can get a list of the escaped characters used to make up the prompt here: www.gnu.org/software/bash/manual/bashref.html#SEC83. Remember to write this to the .bashrc file in your user directory to make it permanent-

#12: Re-using old commands.

It's a pretty common situation to find you once typed a huge long command that you thought you would never need again, but now you do, but what's the fix? Well, if you're using Bash, you can make use of the history feature (use the Up arrow) of Bash. But what if you have only a vague memory of the command? The history command can help:

history | grep -i "<yoursearchstring>"

The numbers indicate the history file number of the command, you can execute it by simply typing '!' followed by the number at the bash prompt.

#13: Seeing further into the past

If your Bash history file never seems to go back far enough to find the command you want, just change the history file size by putting the following in your .bashrc file

HISTSIZE=10000
HISTFILESIZE=10000

You can also use unset HISTSIZE and unset HISTFILESIZE to permanently keep all commands entered, but that should be used with caution.

#14: Reduce typing and memory usage

Long commands are easier to mistype, and lists of long arguments are harder to remember. If you regularly use a command with the same arguments, create an alias to run it by adding:

alias myalias='longcommand --with --lots --of --options'

to your .bashrc file (or the system /etc/profile) and you can run the whole command with myalias, or even mya[TAB]. You can add further options or arguments when running the alias, which are passed to the original command, like

myalias myfile

System administration

#15: Ignore upgrades you don't want

Apt - the Debian packaging system - lets you 'pin' packages so that they never get changed by other software upgrades. For example, if you want a specific version of GCC, install it as normal then load Synaptic, choose the software you just installed, then make sure Lock Selection is checked from under the Package menu.

No more will other packages be able to dictate what version you have installed!

#16: Quick renames

Can you remember back to your first days with Linux or Unix, and all the problems you had when things didn't work quite how you expect? A lot of people moving to Linux from Windows think they can take their DOS skills and apply them straight to the command line, but that leads to all sorts of problems - not least the lack of any sort of disk defragmenter on Linux!

But a common source of confusion is how Linux uses mv instead of ren to rename files, which is kind of second-nature to us Linux veterans because obviously moving a file is the same as renaming it. That said, Linux does actually have a rename program all of its own, called simply rename.

It's quite different to mv, though - rename's job is to mass-rename one lot of files to something else. For example, back when PHP 3 was the norm, PHP files had the extension .php3. When PHP 4 came out, everyone moved to plain old .php, so you might want to rename all your .php3 files to .php. Well, that's what rename is good for, like this: rename .php3 .php *.php3

#17: Get off my files!

Unix-like systems such as Linux have one feature that is simultaneously very annoying and very clever: if someone is reading from a file and it gets deleted, that file actually sticks around until it is no longer being read.

In fact, you can even write over the file, and it won't affect the person reading it, which is great for when you make changes to your website and don't want to interrupt Apache; but can be annoying when you're trying to delete a file and lots of people are using it.

Here's the fix you've been waiting for: the fuser command lists all the processes that have a handle open on your file, and you can even pass the -k switch to kill off any processes that are working with it. Do that, then delete the file freely!

#18: Absolute deletion

Using rm to delete files is just begging people to skank around your disk to read the old data, which is no good if you really want your files to disappear forever. Fortunately for all of us, there's the shred command, which overwrites your file with new data multiple times before deleting it, which makes recovery absolutely impossible.

For example, if you wanted to be absolutely sure that the file passwords was removed, you would use this command:

shred -z -u passwords 

That overwrites the file with random data 25 times, which is then followed by a final zero pass (-z) so that no one can tell you've shredded something, then removes it (-u).

The removal isn't enabled by default, because you can tell shred to work on entire partitions (eg shred /dev/hda1), in which case you probably don't want it removed.

#19: Automated kernel installation

When compiling a custom kernel, there is no need to copy the kernel and other files manually. Running make install after compiling the kernel will copy it to /boot and also place a backup copy of the kernel configuration there. More importantly, it will create symlinks from vmlinuz to your new kernel and vmlinuz.old to the previous one.

If your bootloader has entries for these two kernels, you can always boot the newest and your older fallback kernel without touching Grub or Lilo's configuration files. make install will also run Lilo if necessary.

#20: Watch the logs

You can monitor system log files to see what is reported as you try to run a program or plug in some hardware. Most programs send reports to the system log, which you can watch in a separate root terminal with

tail -f /var/log/messages

The -f, or --follow, option shows messages as they are written to the log, and you can use this with any log file. If there is too much noise for you to be able to read any useful information, use grep to show only messages relating to your process with

tail -f /var/log/messages | grep ssh

#21: Simple web filtering

If there are sites you don't want your users going to, there's one quick fix way to block them for good: open up your /etc/hosts file and add lines like this:

127.0.0.1	myspace.com
127.0.0.1	facebook.com

For added policing effect, put up a web server at the local machine and put a nice warning message up there about the dangers of social networking for kids!

#22: Test your system to the limit

So you've built your shiny new server, and you've got Apache, MySQL and PHP all working nicely, but do you know what happens if your server comes under a lot of load? If not, it's worth finding out, so that you can put recovery mechanisms in place and make sure you adjust your quality of service mechanisms to serve the most important requests first.

You can artificially bump up the load on your box by using the dbench tool, eg dbench 20 should give you a good chance to make sure SSH is nice and responsive so you can still administer your box if it comes under pressure!

#23: User slaying

There's nothing worse than finding all that important Crack Attacking you're doing suddenly gets ground to a halt by some greedy user logging and chewing up valuable CPU time with report generating or database querying.

And so God gave us the skill command, which sends a signal to a particular process, terminal or user, allowing the root user to control precisely what other users are up to. Our particular favourite is skill -KILL -u degville, which means "kill of all of Degville's programs, then log him out." Then you can go back to Crack Attack and devote your full attention to it...

Firefox

#24: Duplicate tabs

Everyone knows that Ctrl+T brings up a new tab, but did you also know that Ctrl+Z automatically sets the new tab to have the same URL as the previous tab? It's great for duplicating windows!

#25: Shorter download notices

"YES, I KNOW ALL THE DOWNLOADS FINISHED - GO AWAY!" is a fairly regular mental scream around here. You see, Firefox likes telling you when all downloads are finished by bringing showing a small box in the corner of your screen, happily obscuring anything else you might have down there.

Yes, the little download box is useful, but no, we don't need it hanging around there for four seconds - go to the URL about:config in Firefox and change the alerts.totalOpenTime setting to something nice and quick, like 500 (milliseconds, ie half a second).

#26: Firefox profiles

In the old days, running any Mozilla application twice at the same time would usually bring up a silly profile manager screen that didn't seem to make much sense.

But with Firefox having a billion-and-one configuration settings that can highly customise your browsing experience, there's finally a real use for the profile manager: you can create one full of tweaks, bookmarks, toolbars and extensions for power browsing, and another RAM-light profile that keeps caching to a minimum and loads a lean and mean Firefox that's great for checking emails and reading the news.

To get to the profile manager screen, just run Firefox with the -profilemanager parameter, eg mozilla-firefox -profilemanager.

#27: Kill the popups for good

Surprisingly enough, Firefox allows 20 popup windows to appear simultaneously, which is enough to completely fill your screen with crapware advertisements. This is a silly high number, so change it something more sensible by editing the dom.popup_maximum setting - we'd recommend somewhere between 3 and 7.

#28: Stop the picture shrink

Here's one feature you either love or hate: when Firefox opens an image that's too big for your browser window, it automatically gets resized down to fit.

Usually this is on by default, but if like us you always find yourself clicking to make the picture bigger anyway, you might as well go to about:config and change browser.enable_automatic_image_resizing to be false.

#29: Can the Go button

Desperate to maximise the amount of space on your Firefox window? Well, think about this: how often do you use the little green 'Go' arrow button next to the location bar? Probably never, we reckon, which is why we often remove the little blighter altogether - to do the same, change browser.urlbar.hideGoButton to be true.

#30: Not so lucky after all

If you type some text into the location bar and hit Enter, Firefox will automatically use Google to search for the best-matching site and load it using I'm Feeling Lucky.

If this irks you, change the keyword.URL value in about:config to whatever search string suits you - http://www.google.com/search?q= is quite common, because that performs a Google-seach on the text and brings up the normal results page rather than just jumping to the first result.

Desktop

#31: Disable your touchpad

Ever had the frustrating experience of nudging your laptop's trackpad while typing, only to have it count as a click and move the cursor somewhere you didn't want it? Sure you have - but it's easily fixed! Edit your xorg.conf file as root, then make sure you add this line to the InputDevice section of your trackpad:

Option "SHMConfig" "on"

Now go to System > Preferences > Sessions and click the New button under Startup Programs, and add the following command: syndaemon -i 1 -d. Now restart your machine, and you're all set - your trackpad will still work as normal, except now you can't knock it by accident while typing!

#32: Hide Gnome apps in KDE and vice versa

Running Ubuntu is great until you try to install Kubuntu (or vice versa), because your previously neatly organised menu system goes into overload meltdown with dozens of programs from both desktops fighting for your priority.

But there's a fix: you can force individual shortcuts to appear only in Gnome or only in KDE as opposed to being in both. To do this, switch to root and browser to /usr/share/applications (for Gnome apps) or /usr/share/applications/kde (for KDE apps). Then open a shortcut file in your text editor, and add one of these two lines to the bottom:

OnlyShowIn=KDE 

for KDE-only applications; or

OnlyShowIn=GNOME 

for Gnome-only applications.

#33: Stay in the loop even when offline

We love Evolution's web calendaring system, because it's smart, fast and easy to use. So you can imagine our pain, then, on the rare occasions we go offline and suddenly find our calendars missing. But there's a quick and simple fix for this - go to your right-click on your calendar, choose Properties, then make sure the Copy Calendar Contents Locally box is checked. Easy!

KDE

#34: Watch, don't wait

Some command-line commands, such as "tail", print out information when something of interest happens, as opposed to just constantly printing out a stream of text.

If you want to keep an eye on something without literally having to stare at it, Konsole has the perfect option for you: go to the View menu and choose the Monitor For Activity option. Now you can carry on with your normal work, and Konsole will flash when your terminal has something of interest for you.

#35: Add Close buttons to Konqueror tabs

Firefox has an option to add a Close button to each tab; so does Konqueror but it replaces the website icon. To get the best of both worlds - a site icon that turns into a Close button when the mouse is over it - load ~/.kde/share/config/konquerorrc into your favourite text editor and add the following to the section starting with

[FMSettings]:
AddTabButton=false
CloseTabButton=false
HoverCloseButton=true

#36: Calculations at your fingertips

Most people know that Alt+F2 brings up the Run command where you can type in commands you want to run, but did you also know that you can use it for quick calculations? Try it out - press Alt+F2, then type 4+9*5/2 and click Run; you should see the answer 26.50000000. It's very basic, but you're able to do calculations with +, -, *, / and brackets/parentheses, which is enough for basic calculation purposes.

#37: Easy info pages

Man pages are easy to read (if not always easy to understand) but some programs put their best documentation in info pages. The info page reader uses some arcane keystrokes to navigate what is basically hypertext, making it unintuitive for less-than-regular users. So use a hypertext reader you are used to: a web browser.

Type info:progname into Konqueror (or the Alt+F2 Run command requester) to read an info page as if it were a web page, complete with clickable links.

#38: Even quicker acronym searches

The Alt+F2 box has another cool feature: all those quick searches you use in the Konqueror location bar work just as well from the Alt+F2 command runner! For example, to do a quick search for poodles, just hit Alt+F2, type gg:poodles, then hit Enter - Konqueror will automatically launch and get pointed at Google with your results.

#39: Delegating power

The KDE Control Center is the hub of KDE's configuration for your PC, which means if you want something changed you'll probably find it in there somewhere. But if you find it's a bit too much - either for you, or for someone whose PC you're setting up who is a bit afraid of Linux - then you ought to try creating your own Control Center shell that loads only the modules you're interested in.

For example, if you wanted to run Control Center so that you only saw the colours, fonts, screensavers and style options, you would use this command:

kcmshell4 colors fonts screensaver style 

Note the US spelling of colour!

Gnome

#40: Add scripts to Nautilus

Right-clicking on your desktop gives a traditionally Gnome-like selection of options: you can move the icons around a bit, change the background, and that's about it. But Nautilus is capable of so much more - in fact, you can super-charge your Gnome right-click menus by installing Nautilus shell scripts into your ~/.gnome2/nautilus-scripts directory.

There's a great selection of scripts available from http://tinyurl.com/ype2eq - try some of them out to see which suit you!

#41: Make Gnome menus appear faster

One of our pet peeves is how slow the Gnome menus appear when you hover over them, which is a shame really because that's something we can fix in five seconds flat - just put this text into the file .gtkrc-2.0 in your home directory:

gtk-menu-popup-delay = 0

#42: Add more functions to Nautilus

Nautilus has a surprising amount of power with its extensions, but none are installed by default leaving it looking somewhat bare. That's easily fixed, though, particularly if you're using Ubuntu - just apt-get the nautilus-gksu and nautilus-open-terminal extensions, restart Nautilus, enjoy the feature upgrade!

#43: Change default browser for files

Not everyone likes Nautilus. In fact, if you're a power user, a slim-and-light lover or indeed anyone who gets bored with blandness easily, Nautilus is rather hard to love.

Fortunately, you can force Gnome to use a different file manager for the Places shortcuts shown in the menu bar, because each of these have their own application shortcut shown in /usr/share/applications. For example, if you want to launch a different file manager when you click Places > Home Folder, crack open the /usr/share/applications/nautilus-home.desktop file and change the Exec line to your browser of choice.

#44: GTweakUI heaven

Gnome, like most Apple software, likes hiding options from you that take some hacking to reach. So hurray, then, for GTweakUI, which opens up a whole new world of options to play with. Our particular favourite is "Use home folder as desktop", which means you get instant access to all your files without going through the Places menu. But there are lots to play - get tweaking!

Performance

#45: Super-fast temporary files

Remember the old days of RAM disks? Well, Linux has them too! If you've never tried them, a RAM disk is a virtual filesystem that runs entirely from your PC's main memory, which means it's lightning fast to read and write anything you want.

How much space you choose to allocate to your RAM disk is down to how much RAM you have and how much you plan to use it - if you have 1GB of RAM, you can easily spare 64MB for a ramdisk; if you have 2GB you can probably spare 256MB, and if you're lucky enough to have 4GB then you can easily stretch your RAM disk legs with 1GB.

Here's how to set up a 64MB disk - just change the 65536 for the size you want:

mkfs -t ext3 -q /dev/ram1 65536
mkdir -p /ramdisk
mount /dev/ram1 /ramdisk -o defaults,rw

Alternatively, a reader suggested you could also try using tmpfs, like this:

mkdir /ramdisk
mount none -t tmpfs -o size=256M /ramdisk

That will allocate 256MB of space to your RAM disk. If you skip the "-o size=256M" part, half your RAM will be used by default.

#46: Avoid the disk

There's very little that's more annoying in Linux than its ability to use the swap file completely regardless of how much RAM you have installed on your machine. Yes, this is helpful in some scenarios - notably when your system is under heavy load and is really getting maxed out - but generally, if you have 2GB or more RAM, you'll have lots free waiting to be used.

The way to force Linux to use swap space less is to edit the /etc/sysctl.conf file and to look for (or create) the vm.swappiness line. If you have lots of RAM and want to minimise the amount of swapping Linux does, set the line to be this:

vm.swappiness=10

#47: No more disk thrashing

We've said this time and time again, but people really never seem to take it seriously: if you want your disks to run at their full potential, make sure and enable the relatime option in /etc/fstab.

You see, every time your disk does a read (eg reading a file), it also does a write, to store the information pertaining to when the file was last read. This process is incredibly slow, and you can get a sizeable speed boost - usually around 10 per cent - with just one simple tweak.

Switch to root, then open up /etc/fstab in your favourite text editor. Look for where you root filesystem is, and make sure that it uses defaults,relatime,data=writeback for its settings, then save, reboot and let your poor overworked PC perform to its full potential... At last!

OpenOffice.org

#48: Styles on your keyboard

It's one thing spending time adjusting the OpenOffice.org styles to fit your needs, but it's quite another to be bothered to apply those styles everywhere they are needed!

And admittedly it's a bit of a pain to take your hands off the keyboard, point and click your mouse on a style, then carry on typing, so it might be surprising that OOo doesn't allow keyboard shortcuts for styles.

But here's the thing: it does let you apply keyboard shortcuts, but it takes a bit of hacking. First, set up your styles just as you want them. Then go to Tools > Macros > Record Macro, and click the style you want to apply.

Now click the floating Stop Recording button and save your macro as ApplyingStyleXYZ (you can't use spaces in your names, remember!). You've basically made OOo write a little program to apply that style for you.

Now for the magic: click Tools > Customize, select the Keyboard tab, then scroll down the list of shortcut keys until you find one you like, eg Ctrl+Shift+A.

In the bottom part of the window, choose OpenOffice.org Macros > User > Standard > Module1 from the Category list, then you should see your macro name appear in the Function list. Choose that, then click Modify - this assigns the selected macro function to the selected shortcut key, essentially making Ctrl+Shift+A apply your style immediately.

#49: Skip the branding

Sick of the way you get a splash screen every time you open an OpenOffice.org program? Well, if you can find the OOo configuration file on your computer, you can disable it. Windows users should find the configuration file in their OpenOffice.org installation directory, under the 'program' subdirectory - look for soffice.ini. Linux users should look for the sofficerc file. Open that using your text editor, and change this:

Logo=1

to this:

Logo=0

OOo will now load significantly faster, and take up less screen real estate while it loads - winner!

#50: Help the widows and orphans

There are two things that make magazine proofreaders pull their hair out: orphans and widows and spelling errors. OK, so that's three things: orphans, widows, spelling errors, late text arriving from writers, and stale style guides. And... well, alright - all sorts of stuff makes them angry, but as far as we're concerned for this tip, it's the orphans and widows that are most important!

An orphan in the publishing world is any word that appears on a line by itself at the end of a paragraph, and a widow is a part of a sentence that finishes a paragraph that runs over to the start of a new page. Both look bad, but rather than making creative use of empty line breaks, you should let Writer do the hard work for you - go to Format > Paragraph > Text Flow, and make sure Orphan Control and Widow Control are both enabled.

First published in Linux Format

First published in Linux Format magazine

You should follow us on Identi.ca or Twitter


Your comments

completion in braces

I've wondered for a while and figure I'll ask it now...as in the example in 4 is there a way to use completion on the directories/filenames in the braces?

#45: Super-fast temporary files

Generally it's easier to use tmpfs on a modern system:

mkdir /ramdisk
mount none -t tmpfs -o size=<maxsize> /ramdisk

Where <maxsize> could be say 1G or whatever and defaults to half of your RAM.

#12: Re-using old commands.

Instead of typing that command, it is much easier to press CTRL+R and then type a few letters of the command(they do not have to be first letters, you can start from the middle of the command). At the end, simply press ENTER to execute.
If you have some very long similar commands, simply press CTRL+R, type letters and then press CTRL+R once again for more commands.

#12: Re-using old commands - one more thing.

If you want to have the command in prompt without executing press TAB instead of ENTER.
It works at least in bash.

The automated kernel tip

The automated kernel tip that you mention is half correct. If you meant how to just install a kernel without it booting then fine. Or if you meant that everything is built into the kernel then fine again. Also if you meant that the menu.lst file is pointing to vmlinuz and not vmlinuz-version, which is usually the case with most distros, then it will work.

But usually after doing a make install, you also have to do make modules_install && make firmware_install. Then you also have to build an initrd image, if you did not build the file-system into the kernel without an initrd you will get a kernel panic. Thus, altogether the steps would be;
1.) make config --> select options which you want
2.) make
3.) sudo make install
4.) sudo make modules_install
5.) sudo make firmware_install
cd into /boot/grub/
6.) mkinitramfs -o initrd.img version-of-kernel-you-built
7.) sudo vi ./menu.lst, and change it as needed to point to vmlinuz instead of vmlinuz-version and initrd.img

Hope I didn't miss any steps.
8.) sudo reboot

#74 - use relatime, not noatime

On the atime front, the One True Path of Righteousness is to use "relatime", rather than "noatime". It cuts the extraneous atime updates to almost zero, but bundles them into any other changes going to the inodes anyway. This is what Linus Torvalds recommends, and what Ubuntu uses by default.

Re: #45, #74

Thanks for the feedback folks - we've updated the article.

more more more more ;)

thanks for the great articles hope more are coming..

Couple more aliases (list

Couple more aliases (list dotfiles/directories only):

alias ls.="ls -a -I '[!.]*'"
alias lsd="ls -d */"

If you have a noisy DVD drive which is spoiling your enjoyment of a DVD movie and would prefer to copy it to your hard drive and play it from there:

# access it first (you could use your player, e.g. xine, here):
disc_id /dev/dvd
# copy it (takes a while):
dd if=/dev/dvd of=~/Movies/Movie.iso
# play it:
xine --disable-post dvd://home/user/Movies/Movie.iso

(disc_id is from libdvdread).

#18: Absolute deletion

You have mentioned only shred.
What about wipe?

Awesome tips man

Glad that you take all the time to post this one. Cool!

Great tips.....but BEWARE

defaults,relatime,data=writeback

BEWARE...entering the above line in my fstab meant that I could no longer read any of my USB drives or flash drives I have now got rid of that line and can see my drives again.

minicli/krunner calculations

#36 will work in the KDE3 alt+F2 minicli as written above, but for the krunner alt+F2 dialog in KDE4, you need to add "=" in front of the expression for it to be recognized.

eg. "=6*9" rather than just "6*9"

Please verify usb drive/flash problem

Can anyone else verify the problem that Dunbrokin had with the fstab change? Were the fstab options added only to the root '/' entry? Why would this affect usb/flash?

Dunbrokin's problem

Anonymous Devil,

I'm pretty sure that Dunbrokin has "done broken"[sic] his fstab by copying those fs options to a line all by themselves rather than by adding them to the options column of one of his existing entries.

Read his posting carefully. ("I now have got[sic] rid of that line").

Also it's silly to leave the keyword "defaults" in there when you are, in fact, putting any non-default options in that field. "defaults" is only necessary as a placeholder (to keep the fstab entries valid) when you aren't supplying any non-default options.

Tip 9 is extra value

"Turn off the coloured output from ls" in tip 9 could almost be called a separate tip ;-)

21 ... thought about this but ...

21 didn't work for my 11 year old daughter. She started using the proxy instead ...

#49: Skip the branding

If you have OpenOffice.org 3, you can edit the sofficerc file found under <your directory>/openoffice.org3/program/.

#20: Watch the logs

You can also redirect the output of the tail command like so:

tail -f /var/log/messages 1> /tmp/message.txt

Then just create a desktop shortcut to /tmp/message.txt. One click and you get your messages.

Here's another useful example of redirection. If you have a SMART enabled hard drive (and most are), you can create a status_hda.sh file that contains:

#!/bin/sh
smartctl -s on /dev/hda 1> /tmp/status_hda.log
smartctl -t long /dev/hda 1> /tmp/status_hda.log
smartctl -l selftest /dev/hda 1> /tmp/status_hda.log

(Yes, I know, not the proper way to create a script....)

Place status_hda.sh in your /etc/cron.daily directory then create a desktop shortcut to /tmp/status_hda.log. One click and you know the status of your hard drive.

my aliases

alias vb='vi ~/.bashrc;source ~/.bashrc'

edits my .bashrc and immediately loads the changes on exit

alias lr='ls -rtl'

lists files in reverse time order, so I can see the last time thing I wrote/downloaded at the end of the list

alias lS='ls -rlS'

lists files in size order with the biggest at the end, so I can clean up space

alias du='du -scm *|sort -n'

helps me to find the directory with the biggest file in it. I also use jdiskreport for this, the only useful Java program I've ever come across

alias df='df -Tm'

shows my mounted partitions, the filesystem type and their size in megabytes

Remove duplicates in .bash_history

1. Remove duplicates in .bash_history
awk '!x[$0]++' .bash_history > .bash.tmp && mv -f .bash.tmp .bash_history

2. Increase the size of bash history
.bashrc
HISTSIZE=10000
HISTFILESIZE=10000

3. Search history
history | grep -i "mpla"

169 history | grep -i "mpla"

4. Rerun a history item
!169

Searching and editing history in bash shell

1. invoke bash shell

2. set -o vi
# for all those vi lovers
#or
set -o emacs
# for the emacs lovers

3. Esc k
# moves curser bottom of file toward top
# shows the last command in the history file

4. Esc /<stringToSearch>
# Search history file top to down

5. Esc ?<stringToSearch>
# Search history file down to top

# can use other vi line editor commands on bash command line

Great article but there is an error...

I was just reading an article where some Linux gurus were bemoaning the fact that there is so much bad advice out there. They targeted a specific article as an example, and one thing they really hit hard on was the use of "Shred". In your article you state this:

"...the shred command... makes recovery absolutely impossible..."

Shred cannot be relied upon to do what you say it will do when one has a journaling file system. The Shred manual itself makes that point. Since almost everyone reading this has a journaling file system by now, you should correct that item. And if you know of anything, it would be great if you would include a better option. Linux appears to be lacking when it comes to security issues having to do with privacy; Windows is actually better for that because there are plenty of tools available in Windows, and very little in Linux (at least very little that I can find).

Otherwise this article was really very helpful. I especially liked the the speedup when I start Open Office now that the branding is disabled. What a difference!

FYI...

i just shat what was, in essence, a functional scat grenade. it emerged from my anus in one big wallop of a push, and consisted of oatmeal-like diarrhea encapsulated in a hard stool shell. it exploded immediately upon exiting my rectum, and the fecal shrapnel covered the interior of my toilet bowl. anyone got a cigarette?

#47

Exactly what am I supposed to do? It should not be entered on a line of it's own.
fstab looks like this:
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda5 during installation
UUID=03520b53-4116-4b06-b7e3-7ddaa7150ab7 / ext4 relatime,errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=5b61ba08-3f8b-4358-9a21-639ffe8284e1 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

cool cores

and assigning cores to processes.. x, ie
would be?

My six core rarely runs over 30% a core.

packrat

Comment viewing options

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

Post new comment

CAPTCHA
We can't accept links (unless you obfuscate them). You also need to negotiate the following CAPTCHA...

Username:   Password:
Create Account | About TuxRadar