Tag Archives: Command-line interface


Mac OS X Quit Application from Command Line

When doing any type of programming or scripting, I do my best to streamline everything (see this post and this post).  Basically anything I do in the Terminal that can be automated, I try to automate.  In addition to the posts linked above, I also have macros set up to login me into the supercomputer that I do most of my research on.

When I first open Terminal, I have it set to open 4 Terminal windows in specified locations.  For those of you who don’t know how to do this, I will soon be providing a post detailing the necessary steps to accomplish this.

Continue reading Mac OS X Quit Application from Command Line

Linux Command Line Password Generator

Computer Security KeyI have access to a few servers/super computers that require me to change my password every 30 days.  In addition to this, after using a password I have to wait 6 months before being allowed to reuse it and new passwords cannot be similar to old password.

This can be rather annoying, as I have only 3 passwords that I have memorized (with varying levels of strength).  Whenever I am asked for a new password, I cannot just sit there and think up one; I have to use a random password generator and then I can finally relax and surf sites like O2.co.uk or my e-mails.

From the linux command line, it is rather easy to generate a password.  I use the following command in my .cshrc file:

Continue reading Linux Command Line Password Generator

Some Useful .cshrc Functions

If you use the command line a lot, there are numerous common commands that can be automated to save time.

Like what? Well, how about swapping the names of 2 files; or maybe unarchiving any filetype.

People who use bash are lucky, bash allows you to actually create functions in the .bashrc file. Those of use who use c-shell, however, have to deal with aliasing.

Below are a few “functions” that i have in my .cshrc file which save me a lot of time.

Swap 2 files

alias swap 'mv !:1 tmp.1 | mv !:2 !:1 | mv tmp.1 !:2'
Use: mturner@prospero: swap file1.f file2.f
Result: The filenames have been swapped for these 2 files

Move and go

alias mvg 'mv !:1 !:2 && cd !:2'
Use: mturner@prospero: mvg file1.f ~/Desktop
Result: file1.f will be moved to the specified directory, and you are automatically cd’ed to the specified directory
Continue reading Some Useful .cshrc Functions