On MacOS X 10.5 there is considerable slow-down in the MATLAB editor and other GUI elements. The issue is related to a change in the default Mac Java 2D rendering engine from Quartz2D (10.4) and Sun2D (10.5). This newer rendering engine improves performance for figure drawing, but …
You can use the command ls --color (or an alias) to show directories with colours for folders, files, links, etc. However, you may not realise these colours can be easily configured using bashrc and a configuration file.
Edit your .bashrc
file (in your home directory) to include the following line …
memcached
is a general-purpose distributed memory caching system
originally developed by Danga Interactive for LiveJournal but now used
by many other sites. It is often used to speed up dynamic
database-driven websites by caching data and objects in RAM to reduce
the number of times an external data source (such …
Haiku is an open source operating system currently in development that specifically targets personal computing. Inspired by the Be Operating System, development began in 2001, and the operating system became self-hosting in 2008 with the first alpha release in September 2009, the second in May 2010 and the third in …
Haiku is an open source operating system currently in development that specifically targets personal computing. Inspired by the Be Operating System, development began in 2001, and the operating system became self-hosting in 2008 with the first alpha release in September 2009, the second in May 2010 and the third in …
A quick one-liner to recursively search files for a given text string.
Open up a terminal session and enter the following - replacing "foo"
with the text to search for.
:::sh
find . -exec grep -l "foo" {} \;
You can also limit the search to files with a particular extension (e.g …
Show another of your blogs or any other RSS news feed on your WordPress blog with this simple template code.
Open your template file in either the WordPress admin editor or via FTP/SSH access to your hosting server. If you want to put the feed links in your sidebar …
A simple trick to make comments from the original post author stand out a bit more in the comment listing - useful for seeing replies to comments.
First you need to create a style to apply to highlighted comments on your blog. To do this, either in the admin editor or …
Sometimes things go a bit wrong. Sometimes they go very wrong. XKill is a simple little application that allows you to kill a running X application that has got out of kilter. Think of this as a quick way to get back control of your Desktop.
xkill (installed by …
On desktop setups where icons are shown on the desktop these are normally taken from the specific folder ~/Desktop. If you find you want to show icons from either your Home or another directory for a particular install/user you can do so by editing the user-dirs config file as …
Screen is a neat little program that allows you to use multiple virtual terminals in a single session on Unix/Linux and Mac. However, it does more than just that. It can also allow you to share your current session on a machine with another user - allowing you to collaboratively …
Install the latest version of Google Earth for linux direct from Google sources.
Open a terminal window to perform the installation (Ctrl-Alt-T
) then enter the following at the prompt:
:::bash
wget http://dl.google.com/dl/earth/client/current/google-earth-stable_current_i386.deb
You will see a progress bar as the …
Bash command substitution performs a given command replacing the marker with the resulting standard output. It is particularly useful when you want to store the output of a command in a variable or as an alternative method of chaining multiple commands together.
Bash command substitution is achieved by wrapping your …
Syntax highlighting is more than just eye candy. It can turn a block of impenetrable code into a simple grok (although it has it's limits). To boost the usability of our code guides on this site we wanted to implement nice clear syntax highlighting of our hacks. Code samples are …
A quick method to remove duplicates from text files - including for example CSV files - where multiple records have been added (perhaps automatically) at different times resulting in multiple copies of the same record scattered throughout the file. Here is a simple one-liner bash command to remove duplicates using sort.
This …
System request (often abbreviated SysRq or Sys Req) is a key on keyboards for PCs that has no standard use. This key can be traced back to the operator interrupt key of the IBM System/370 mainframe computer. But under Linux there's a bunch of useful things available via this …
Brace expansion is one of the most powerful bash tricks with the potential to save you considerable time. Here are some common use cases.
Be careful with the use of spaces as these will stop expansion working. If you have any text containing spaces, wrap it in quotes. However, the …
Find the currently running processes on your system that were not started by yourself. A great way to find out what is hogging your system on multiple-user setups or remote logins.
Open up a terminal session and enter:
ps aux | grep -v `whoami`
ps aux
returns (a) all processes …
Often forgotten the file
command will give you a simple summary of a file's type and content.
At the prompt enter file <filename>
where <filename>
is the name of the file you are interested in.
You will receive output detailing the files contents, e.g.
A Word Document.doc: Composite …
Cinnamon is a re-implementation of the Gnome 2 desktop in GTK3 developed by the Linux Mint project as an alternative to both Gnome3/Shell and Ubuntu Unity. Here we explain how to install Cinnamon on top of your Ubuntu installation, without installing Linux Mint.
As with all Ubuntu unsupported software …
Update your session to new settings in .bash_profile without logging out and back in again.
At the prompt enter:
source ~/.bash_profile
add the following line to your .bash_profile or .bash_aliases file
alias reload='source $HOME/.bash_profile'
after running source ~/.bash_profile
the command reload
will be available to do the same …
Find the pids of all instances/processes of a given program running on your system
Open a terminal and enter ps ax | grep "firefox"
...replacing 'firefox' with the name of the program you are looking for.
The columns in the output are as follows: (1) pid 'process id' (2) tty …
Create your own bash pipes to send program output between shells, processes and users.
You may already be familiar with the | command commonly used to send the output of one command into another, e.g. cat /var/log/messages | less
. Here we create user-defined pipes to carry output between shells …
A short one liner to quickly serve any folder via a http server.
cd
to the directory you want to serve.
At the shell prompt enter python -m SimpleHTTPServer
At the shell prompt enter python -m http.server
CDPATH is an environment variable which tells the cd
command where to look for the specified folder. By including the parent folders of commonly used locations you can access folders more easily - and without typing an entire path.
Open up your shell profile file .bashrc
(Linux) or .bash_profile
(Mac).
Somewhere …
ifconfig.me is a web service that displays information about your connection, including IP address, hostname and User Agent string. Helpfully it provides a simplified interface that can be easily queried to get this information from the command line.
All commands are variations on the below. The full list is …
A quick one-liner to find the most common pages giving 404 errors on your apache2 setup. Set this up as a shell alias to get easy access at any time.
This one liner breaks down as follows:
cut
splits the input (the logfile) by-d
delimiter and returning only the …
Re-run previously entered command as root user.
sudo !!
!!
is automatically substituted to the content of the previous command. Turning the above line intosudo <your command here>
.
Looking Glass is GNOME Shell's integrated inspector tool and JavaScript console useful for debugging.
Open the run prompt by pressing Alt+F2
Enter lg
to start Looking Glass
Commands can be entered directly at the prompt e.g. global.get_window_actors()
Exit at any time by pressing Esc
Debug Gnome Shell, or run it from the console, either for plugin development or troubleshooting.
Switch to the console using Ctrl Alt F1
Type "w" to find your display (usually it's :0.0
)
Export your display (usually with export DISPLAY=:0.0
)
Restart gnome shell from the console by typing …
Bash history expansion allows you to quickly re-run previous commands using ! and the number of the command in your history.
You can adjust the size of the history by setting the HISTSIZE variable in the shell e.g.
export HISTSIZE=1000
. You can clear the current history withhistory -c …
Interactively search through your command line history with a simple keyboard shortcut.
At a new shell prompt (bash or Terminal.app on Mac) press Ctrl-R
Start typing the search string to lookup in your bash history. As you type the top matching command in your history will appear.
Hit Return …
Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn't include with OS X. It provides a simpler alternative to MacPorts, installing under an isolated non-root prefix, symlinked to /usr/local
You do not need to use
sudo
when using Homebrew as software is installed …
GNU Screen is a command-line application that allows use of multiple virtual sessions within a single real terminal or remote session. Importantly, it allows for persistent running of command-line applications independent of the shell that initiated them program, meaning active applications can persist during disconnection.
This is just one of …
When in a repository directory you can show the name of the currently checked out Git branch in the prompt, making it easier to track where you are (and where you're about to commit).
The following instructions are written for Mac OS X (Lion) or later, using a terminal with …
Show a warning in the Terminal's prompt when the current working directory is no longer where the shell expects it to be. (e.g. it was deleted or replaced by a new, different directory with the same name by some other app).
Why is this useful? Take the scenario where …
Install and setup the tools necessary for Android development with Eclipse on Mac OS X (Lion)
Mac running Mac OS X (Lion) (Intel)
Download Eclipse Classic for Mac from the Eclipse download page.
Eclipse Classic is recommended but those who know they need a different version can download …
Initialize a Git repository from a local directory, and the files therein, pushing it to an existing but empty remote.
Assumes that the remote bare repository has been created.
Open a terminal/console (Terminal on Mac/Linux, cmd.exe on Windows) and …