How to view a fragmentation analysis

How to view a fragmentation analysis

How to view a fragmentation analysis One complaint about Vista's built in defragmentation program is that it doesn't give you much information. That's true of the graphical interface, but you can use the command line defrag utility to view an analysis of the amount of fragmentation on a per-drive basis. Here's how: 1. Click Start | All Programs | Accessories 2. Right click the Command Prompt and select Run As Administrator 3. Click Continue at the UAC prompt if you're logged on with an administrative account, or enter administrative credentials if you're logged on as a regular user 4. At the command prompt, type defrag : -a The output will show you the volume size, amount of free space, largest free space extent and percent of file fragmentation. It will also tell you whether you need to defragment the drive.

How to change the message on the XP logon dialog box

How to change the message on the XP logon dialog box


By default, the logon dialog box says "Enter a user name and password that is valid for this system." But you can make it say whatever you want, by editing the registry. As always, be careful and back up your registry first. Then here's how:
1. In your registry editor, navigate to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ Winlogon
2. In the right pane, double click an empty spot and choose New. Create a new REG_SZ (String) value and name it LogonPrompt.
3. Double click it and in the data value field, type whatever message you want to display.

How to install the Mf.sys driver in Vista




The Mf.sys device driver that was included in previous versions of Windows is not installed in Vista by default. Although only a few devices now use it, if you happen to need to use one of them, your installation will fail unless you install the driver. Here's how:

  1. Open Windows Explorer and navigate to the System32 folder in the Windows directory (you may need to first configure folder properties to show hidden and system files in Explorer's Tools | Folder Options | Views dialog box).
  2. Locate the System32\DriverStore\FileRepository folder.
  3. Find the Mf.inf_[hexadecimal number] folder (for example, the folder name might be Mf.inf_dcf62a9a) and double click it.
  4. Within the folder, right click the Mf.sys file and select Copy.
  5. Go to the System32\Drivers folder and paste the file there. Alternatively, you can right drag and copy.
  6. In the Destination Folder Access Denied dialog box, click Continue.
  7. In the User Account Control dialog box, click Continue.

The .inf file for the device should contain both a DDInstall section and a DDInstall.Services section. Now you should be able to install the device.

 

The Linux Command Line

 

The Linux Command Line, Revisited

 

The Linux command line. It strikes terror (or, at least, queasiness) in some. It's arcane, it's not point-and-click, it just doesn't look good. But as a previous TechTip explained, if you're running Linux on your desktop computer or laptop computer, a knowledge of the command line can make your life much easier.

 

While the previous TechTip explained the basics of the command line, this one looks at several useful commands and functions that you can use in a terminal window.

 

Viewing running processes

 

Like any other operating system, Linux has a number of system processes running in the background. These are in addition to whatever applications that you may be running. Using the ps command, you can view a list of the applications and processes that are running on your system.

 

When you type ps, you'll probably only get a list of two or three processes. To view the process and applications that are running during your session, type ps -u <username>, where <username> is the name that you use to log into Linux -- for example, ps -u scott.

 

PS_IMNotice that in addition to the name of each application or process, they have a number identifying them. This is called a pid (short for process ID). In the accompanying screenshot, notice that the application Thunar (a file manager) has the pid 5214.

 

I bet you're thinking that this is all interesting, but how is viewing processes useful? Keep reading ...

 

Killing processes

 

No matter how well coded an application is, it may hang. When it does, you can shut it down completely using the kill command.

 

So, let's say the Thunar file manager has hung. Actually, it did hang on me a week ago. To kill it, first run ps -u <username> to find its the pid. In the screenshot above, the pid for Thunar is 5214. To kill it, enter the command kill 5214.

 

Of course, the kill command can be quite dangerous. You need to make sure that you specify the right pid, or else you'll stop and application or process that could be important. With an application, you can lose your data. You won't get a warning to save a document or file; the application just shuts down.

 

Viewing text files with less

 

A friend of mine jokes that Linux isn't a set of programs but just a bunch of text files that simulate an operating system. That's a bit far fetched, but Linux is known for the large number of text files that it does employ. Files like system configuration files, application parameters and configuration files, scripts, and text files that you create with an editor or which come with an application (like readme files). Instead of firing up a text editor to view these files, use the less command.

 

Less_IMTo use less, just make sure that you're in the same directory as the file that you want to view and type less <filename>, where <filename> is the name of the file that you want to browse.

 

The less command displays about 25 lines of the file at a time. To move down the file, you can press Enter or the down arrow key (to move one line at a time), or press the space bar to move one screen at a time. You can move up by pressing the up arrow key on your keyboard, or by pressing b.

 

You can even search a file while viewing it with less. Just press the forward slash key (/), type in the word or phrase that you want to find, and then press Enter. Note that the search is case sensitive.

Typing linux isn't the same as typing Linux. Often, though, you won't find exactly what you're looking for on the first try. To keep searching, press n on your keyboard.

 

If you want to get out of the viewer, press q on your keyboard.

 

Using sudo

 

One of the great things about Linux is that it doesn't allow you to tamper with certain system files and directories. You might be able to view or run the files in those directories, but you can't delete the files or copy things in or out of those directories.

 

You can, however, get access to those files and directories using the sudo command. sudo is short for super user do. It gives you what's called root access but only for the single run of a program or script.

Why would you need to use the sudo command? You may, for example, need to install fonts for a particular application or install a program that you've compiled. Or, you might need to back a file up sudofrom a protected directory to a location in your home directory.

 

Use this command by typing sudo followed by the name of the command that you want to run. In some Linux distributions, you'll be asked for the password for the root account. Other distros, like Ubuntu and its variants, don't have a true root account; you're prompted for your login password.

 

Here's an example: sometimes, I download a useful program or script. I like putting it in the directory /usr/local/bin/, which lets me run it no matter where I am in my Linux file system. But /usr/local/bin/ is one of those protected directories. To copy the file, I type sudo cp <file> /usr/local/bin/.

 

Sudo is another command that is potentially dangerous. If you're not careful, you can overwrite or delete an important file. It happened to a friend of mine, who accidentally zapped a library file used by his window manager. Without that file, the window manager wouldn't start.

 

Running programs from the command line

 

Obviously, you can run any application -- graphical or terminal-based

-- by typing its name at the command line and pressing Enter.

Graphical applications will run in your window manager; command line applications in the terminal window.

 

You'll notice, though, that when you run a graphical application you can't run any other application in the same terminal window. Sure, you can open another terminal or pop a new tab (if your terminal program supports that), but why bother? Why not run your program in the background instead?

 

Runback_IMTo run a program in the background, type the name of the program, followed by a space, followed by an ampersand (&), and then press Enter -- for example, gimp &.

 

Sometimes, you may try to run a program or script that resides in the directory that you happen to be in. When that happens, you might get an error message like command not found. Nothing's more frustrating that trying to run an application or script that you know is there.

You can get around this by typing a dot and a slash (./) before the name of the program or script. To run the script to back up my company's Web site, I change to the directory in which the script resides and type ./dmn_bkup.sh.

 

The wonders of autocompletion

 

Typing a command or a file name at the command line, especially if it's a long one, can be a real chore. And if you're not paying attention, you could type the wrong thing. Instead of typing a long string, press the Tab key on your keyboard to complete the name of the program or file. The Linux shell (another term for the command line) scans the file in your path and in a directory, picks the one that matches what you typed before pressing Tab, and automatically fills it in at the command line.

 

Autocompletion is incredibly useful when moving around at the command line, or when copying files from one location to another. How? If, say, I want to change to the directory /usr/local/bin, instead of typing 14 characters I just type /usr/l, and press the Tab key -- which completes /usr/local/. Then, I type b and press Tab again, which completes the full path. I manage to do the same job with half the number of keystrokes.

 

IMConclusion

 

The Linux command line is definitely a powerful tool. While the commands in this TechTip, and the previous one on the same subject are useful, there are so many other commands that you will find useful.

You can find good references online here and here. If your reading tastes lean more towards dead trees, then definitely check out The Linux Cookbook and the Linux Phrasebook.

 

Regardless of your level of experience with Linux, understanding the command line and how to use it can definitely come in handy. You might not pop into a terminal window daily or even regularly, but when you do having some knowledge means that you'll be better equipped to handle yourself.