BLT – Command Line Twitter Client


If you're new here, you may want to subscribe to my RSS feed.

There are some scenarios in Unix/Linux when you are stuck at the command line and not able to get to a GUI interface. With this in mind, there is a Twitter client out there that will let you view your tweets at the command line. The application that will let you achieve this is called BLT (bash loves twitter).

BLT is a perl application that integrates Twitter into the command-line, and to install BLT, perform the following option:

sudo cpan App::BLT

After you have BLT installed, run blt at the command line and it will ask you for your Twitter username and password. You may also want to run a blt --check to grab the latest tweets from your account after you have set up the user interface.

Read the rest of this entry »


Want An OS X Dock On Your Linux Box?


If you are an Linux user and want your desktop looking more like Apple OS X, this post is for you. One of the cool things that Apple’s OS X operating system includes is the dock down at the bottom of the main desktop window. This makes your commonly-used programs easy to get to without having to go through a process of searching for them.

With this in mind, there is an application that you can install on your Linux box that acts a dock for you. This application is called KDocker.

Read the rest of this entry »

Want To Do a Quick Find/Replace? Use ‘sed’!


If you are ever need to do just a quick and simple find and replace and don’t want to do it in an editor? You can use the sed command.

If you are familiar with vi, the find and replace string will be very familiar. The format of the find and replace is:

sed 's/oldstring/newstring/g' file.txt

However, if you are wanting these changes to be reflected in a file, you will need to perform an output at the end of your sed string, like so:

sed 's/oldstring/newstring/g' file.txt
> changedfile.txt

I have provided an example of how to use the principles below:

How To Change Login Screen Background Via Terminal


Sick and tired of the same old bluish background of the Mac OS X login screen? I have now found out a way to change it out. Simply modify/replace the following files:

/System/Library/CoreServices/DefaultDesktop
.jpg
(Leopard users)

/Library/Preferences/com.apple.loginwindow (Tiger users: modify this file)

Once this has been done, open a Terminal window and execute this line at the command prompt:

sudo defaults write
/Library/Preferences/com.apple.loginwindow
DesktopPicture '/Path/To/Picture.jpg'
(all on one line)

Once this has been done, log out of your account. When you log out, you should instantly see the changes that you have made.

Want Color in Your Text Editor?


If you are a programmer or a web designer, and want to have color designation to your coding without having to buy Dreamweaver or any other pricey HTML editors, I would recommend downloading Vim. Vim is a vi-based clone that allows you to view your code, HTML, CSS, etc. in a color-coded style.

This app can be downloaded by doing: sudo apt-get install vim

VIM can also be an alternative to using vi, which only displays code in monochrome. Here is a comparison of between the physical appearances of vi and vim:

Read the rest of this entry »

Play Tetris in Emacs


If you’re ever using Emacs (Extensible Macro System) as an editor and feeling bored, you can always play Tetris in it. Playing Tetris in Emacs only works in the GNU environment which Mac OS X also runs under. The steps for running Tetris in Emacs have been provided below:

  1. In Terminal, type emacs at the comment. Emacs will then appear for you.
  2. In the Emacs window, press <ESC>. This will bring you to the note buffer section (shown below).
  3. Read the rest of this entry »

Make the most of the Mac OS X’s command line


If you’re like most Mac users, the UNIX command line is the red-headed stepchild of the operating system. It’s always there, but you’re not going to acknowledge its existence — that is, until you need to run an SQL query, make an rsync backup, or generally muck about in the system internals.

Thankfully, TheAppleBlog’s Andrew Bednarz has assembled a compendium of Mac OS X terminal tips, tweaks, and tricks. He shows how to use Visor, a cool program that provides an always-accessible pulldown terminal prompt just like the console in the video game Quake. He also shares some insider UNIX knowledge on tweaking Terminal.app to display color-coded directory listings and more informative command prompts.

Go check out his list of tips. Your command line will thank you.

Having trouble finding text with grep? Try grepping with color


Having trouble finding a needle in a haystack? You can always use grep --color to find what you are looking for. This method is best used for finding a specific piece of text in a document that is all on one line, or a unique string of text within a repetitious document. I have provided the syntax for this grep option below:

grep --color "text" filename

Example:

LSPCI and LSUSB


The commands listed in this post are more for Linux than Unix. To find out information about the hardware of your computer, you can run an lspci command. Lspci will output the specifications of your hardware in a list style arrangement as shown below:

If you want to get more specific in your lspci output (e.g. wanting just to display a certain brand), you can always do lspci | grep -i "Productname" which will only return results that includes the string from your grep command. For example, if I wanted to find all of the hardware made by Broadcom, I would do lspci | grep -i "broadcom" and the results would return only hardware that mentions Broadcom.

Read the rest of this entry »

Need to find a SMALL amount of text in a BIG directory? No problem!


Have you ever tried to grep in a directory that has a vast amount of files and you received an error like this? (below)

If so, there is a simple way around this. Just use this: find . | xargs grep "yahoo" * | more. I will break down these processes for you:

  • find .Find is a command that outputs the location of a file. In this case by specifying a ., the search will only be done in the present directory.
  • xargs – This allows a command to be executed from standard input. This also helps force the grep command (coming next) to return output, even when the directory is too large.
  • grep – The way we will be using this command is to search through a file for a specific string. If you are looking for straight text, it is best to use quotes (e.g. “text”) to help the command line decipher exactly what you are looking for. More info on grep can be found on this earlier post.
  • more – This command is optional for this process. More would be best used if you were expecting a full page of output returned from your search, and want to be prompted for the next page. This option would be very beneficial if the string you are searching for would be common in your results.