See a visual representation of file and folder locations

If you're new to the Ubuntu file system (or even an old hand), it can be easy to get lost while browsing the file system. As mentioned in Chapter 2, An Ubuntu administration crash course, on page 19, the pwd can be used to get a quick reminder of the current folder, but you might also use the tree. First you'll need to install it using Synaptic—search for and install tree. Then just type tree at the prompt.

Here's what I saw on my test system when I typed the command within my /home folder:

-- Desktop

|-- gnome-terminal.desktop '-- synaptic.desktop -- Documents

|-- accounts08.ods '-- brochure.pdf -- Examples -> /usr/share/example-content -- Music

|-- barbecue.jpg '-- disneyland.jpg -- Public -- Templates '-- Videos

It should be obvious what's what here. The folders (Desktop, Documents, Music etc) are represented as branches on the virtual tree, and the files (or subfolders) as sub-branches. What you don't see here, and which is very useful, is that everything is color-coded according the standard color-coding used at the prompt. Thus folders are light blue, image files are purple, the MP3 file is green, and so on.

To see only folders, and not files within them (possibly more useful), use the -d command option: tree -d. To filter the results for a particular type of file, or files with a particular name, use the -P command option. For example, to filter for .doc files, you could type: $ tree -P *.doc

Or to filter for files that include disneyland in their name, you could type: $ tree -P *disneyland*

As if all this wasn't enough, tree has a trick up its sleeve. It can output everything as a hyperlinked HTML file. This can be useful if you need to quickly create a directory listing of online files.

Let's assume that you have a website called http://www.example.com and the local folder that contains your local copies of the site is /home/keir/website. The following command will output a file called index.html that contains a visual tree representation of the files contained within website, including hyperlinks to the files themselves:

$ tree -H http://www.example.com -T "Click a file to download" /home/ keir/website/ > index.html

First we provide the URL that the hyperlinks should be prefaced with. This could be a path on the server (for example, www.example.com/files; [[Author: Note that this isn't a real URL, just a dummy example—example.com is a mandated "test" URL]] note that you must not include the trailing slash in the path). Then we provide the -T command option, which gives the webpage a header—this can be anything you want but steer clear of symbols like !, which have specific functions at the command prompt. Following this we provide the location of the files. Finally, we redirect output into the index.html file.

See also Tip 132, on page 175, to switch to a tree view in Nautilus.

al

1 = ItfiB

File Edit View Terminal Tabs

sJdelp

[email protected]

-$ figlet

'Ubuntu Kung Fu1

fl ffl _

fl

\~\f~i 1 1

1 1 1 1 1 Mil

1 ■ V

J 1 1 1 1 ' / 1 1 1 ' V /. ' | 1 1 II

I

1 1 1 1 1 ) 1 1 1

Mill

_l 1 1 1 1 ■ \ 1 1 1 1 1 1 u 1 1 Ml

I

\ /I - / \

1 1 1 |\

l\ . 1 1 l\ \ . Ii l |\ . 1 1 1 \

1

1 /

keir<akeir-desktap

-S

Figure 3.35: Using Figlet to create a text banner (see Tip 219)

Figure 3.35: Using Figlet to create a text banner (see Tip 219)

Some tips in this book are useful. Some less so. Some are just fun. This tip is one of them.

Start Synaptic. Then search for and install figlet. Then type the following into a terminal window: $ figlet "Ubuntu Kung Fu"

See Figure 3.35 for what I saw. The output is built from symbols, letters and other characters. There's even different fonts available—take a look in /usr/share/figlet. Any file with an .flf file extension is a font. To use a different font, just specify its name after the -f command option, without a file extension:

$ figlet -f lean "Ubuntu Kung Fu"

Believe it or not, figlet did have a serious use (well, actually, its older brother called banner did). In the days of shared dot-matrix printers and sheet-fed paper, the command was used to clearly indicate who had sent which print job. The banner text would appear at the start of any printed documents, so it was clear where the sheet output could be torn-off.

I like to add a figlet command to the end of my .bashrc file so that figlet runs every time I login at a virtual console or open a terminal window. Just type gedit ~/.bashrc to open the file in Gedit and add the entire command as a new line at the end. If you want a sentence to appear, as opposed to just a single word, ensure you enclose the sentence in quotation marks (ie figlet -f small "Greetings Professor Falken").

You might want to take a look at the unfortunately-titled toilet, which does exactly the same thing but with added color. Once it's installed, try the following:

$ toilet -f mono12 -F gay "Ubuntu Kung Fu"

22\ Use a Macintosh OS X-like Dock

Users of Mac OS X will be aware of the Dock, which forms the central hub around which programs can be launched and activated. AvantWindow-Manager is a faithful reproduction that includes several additional features, such as customization options. See Figure 3.36, on the next page for an example of it in action. However, it only works if you have desktop effects enabled—see Tip 74, on page 131 for more information.

Use Synaptic to search for and install the awn-manager package. This will install Avant-Window-Manager and also a useful configuration program. Once installed, you can start Avant-Window-Manager by clicking its entry on the Applications ^ Accessories menu.

You'll need to start by adding some program launchers to it, so click and drag your favorite application icons from the Applications or System menus and drop them onto Avant-Window-Manager. Following this you can launch the applications by simply clicking their icons. Note that Avant-Window-Manager effectively negates the need for a bottom panel so you might choose to delete it (right-click and select Delete This Panel). In fact, the functionality provided by the bottom panel interferes a little with Avant-Window-Manager because applications will minimize to it, rather than to Avant-Window-Manager itself.

To configure Avant-Window-Manager, click System ^ Preferences ^ Awn Manager. Amongst the options worth playing around with are the Look dropdown, under the Bar Appearance tab. Here you can select 3D Look to get a Dock more in style with Mac OS X Leopard.

Figure 3.36: Adding an Mac OS X-like Dock with Avant-WindowManager (see Tip 220, on the preceding page)

To make Avant-Window-Manager start each time you login, click System ^ Preferences ^ Sessions, ensure the Startup Programs tab is selected, and click the Add button. Then type avant-window-navigator into both the Name and Command text fields. Leave the Comment field blank. Then click the OK button.

As mentioned, Avant-Window-Manager can be heavily customized. For more information, take a look at the program's wiki: http://wiki.awn-project. org, or post a message on the program's forums: http://awn.planetblur.org.

For other tips that add bling to the Ubuntu desktop, see Tip 21, on page 79; Tip 79, on page 138; Tip 147, on page 192; Tip 199, on page 237; Tip 74, on page 131; Tip 274, on page 313; and Tip 289, on page 338.

Was this article helpful?

0 0

Post a comment