User Tools

Site Tools


It's well worth learning to use the console in Linux, it may seem daunting at first, but it's very logical and gives you a massive amount of flexibility over your system.

Most popular Linux distributions (Ubuntu, Fedora etc..) use the bash (or very similar dash) command line interpreter or 'shell'.

Try to understand what a command is doing before you use it as you could get yourself in trouble.

Search and replace text in a whole bunch of files

Search for searchforthis and replace with replacewiththis in .htm files:

sed -i "s/searchforthis/replacewiththis/g" *.htm
Create a data DVD from the files/directories in the current directory
growisofs -Z /dev/dvd -dry-run -R -J -iso-level 2 *
Perform a function (delete/etc) on a file search (the correct way)

Be careful with this command. It's worth using ls to see what files will be affected first. In this example we remove all php files that have the permissions 664 (o+rw,g+rw,u+r):

find -perm 664 -name '*.php' -exec rm {} \;

This is a *really* useful command, you can do all kinds of useful things with find, for example you can recursively set the permissions on files and directories etc..

See what temperature your CPU is running at
cat /proc/acpi/thermal_zone/THM0/temperature
command_line/handy_one-liners.txt · Last modified: 2012/01/26 09:11 by import