Monthly Archives: May 2008

Useful Commandline Tools

These are some of the most useful, commonly used, or coolest command line tools that I know of. That doesn’t mean that you will find them useful or use them much; I can only go off of what I know and that is what I do myself :).

You should be able to find most of these pre-installed on any *nix (including mac os).

1. wget
wget is a download manager and is by far my favorite download manager. Some people prefer curl, but I don’t. The most basic usage of wget is just wget (url).

2. rsync
rsync is a very simple but powerful tool. If you aren’t using it you probably should be. It simply “syncs” two folders, meaning that all files from one folder will be copied to another folder (this is a simplistic explanation). The most basic usage you will probably need is rsync -av source/ destination/. This will move any files from source/ that are not already in destination/ to destination/ and replace any files in destination/ that are in both but differ(say destination/ has an old version it will be replaced by the one from source/), note that the v flag is for verbose and may be left off. rsync -av –delete source/ destination/ may be used if you want the contents of destination/ to be exactly the sam as source/.

3. lsof
lsof lists all open files. So want to see what your users are doing? No problem just type lsof as root.

4. history
Ok, you really should know this one. It list terminal history. So you forgot that command you used yesterday to do something, just type history into bash and see every command you have an in the last however long your history is set to store.

5. link/ln
linux links two files together. The syntax is linux source Target. I don’t want to get into the whole hard v symbolic links right now so I will just quote the man page ” A hard link to a file is indistinguishable from the original directory entry; any changes to a file are effectively independent of the name used to reference the file.” ” A symbolic link contains the name of the file to which it is linked. The referenced file is used when an open(2) operation is performed on the link. A stat(2) on a symbolic link will return the linked-to file; an lstat(2) must be done to obtain information about the link. The readlink(2) call may be used to read the contents of a symbolic link.”
note that link and ln are the same thing.

6. periodic
nixen have scripts that they need to run on a periodic bases to keep your system running well. If you don’t leave your computer on 24 7 some of them won’t be ran. If you don’t leave your computer on all the time to keep your system in good heath it is a good idea to run sudo periodic -v daily weekly monthly

7. scp
scp is cp over ssh. It is really nice, trust me. To use it type scp source destination in the terminal. scp is meant to transfer files from one computer to another so either the source or destination will need to look something like username@ipaddress:path. You will also need the user password to transfer files, of course.

8. at
at allows you to run a command in the future. I don’t really use it much and I’m not 100% sure how it all works and its late so I’m going to have to just refer you to the man page. (this is one of the ones that is just cool)

9. clear
clear clears the terminal of all your old garbage. So if you have been working for a while and you want a clean working area just type clear.

For more on any of these refer to your friendly system man (as in man (name of program)…).

1 Comment

Posted by on May 31, 2008 in bash, Commandline, linux


Tags: , , , , , , , , , , ,