CLUELESS at the Prompt
If you are familiar with that other windowing system, you may be aware of the concept of multitasking. Using a single computer to do several applications at once is a highly desirable trait for an operating system (OS).
It's fairly obvious how to accomplish this in a windowing environment, but not so obvious at the shell prompt. Here are some of the details.
When you start a program at the shell prompt, you can stop it by typing:
which returns you to the shell prompt. Then type:
bgand the program or job is restarted in the (b)ack(g)round. A job can also be put in the background from the beginning by typing an ampersand (&) at the end of the command, e.g., make filename&. Running your job in the background allows you to run another job at the same time without changing to a different virtual console (VC). The job can be brought back to the (f)ore(g)round by typing: fg, if its the only background job, or fg jobno, if there is more than one.
You can change to a different VC by using the Alt-F2 (through F6) command. Each one of these can also be used in the manner that I have described, to the extent that you can easily run out of resources in a fit of deep-hack-mode euphoria, if you aren't careful. If you get really exuberant, you could even forget which jobs you have running. Relax, you can “remember” them by typing:
This command lists all jobs running in the background, much like the ps command lists all processes that are currently using up your precious memory and CPU.
When you boot up Linux, your file system or rather your hard drive must be mounted, so that the file system can be read and acted on. Your floppy drive, tape backup or CD-ROM cannot be automatically mounted, so you may need the mount utility. For example:
mount -t ext2 /dev/fd0 /mnt
mount -t msdos /dev/fd0 /mntmounts your floppy drive (called a: by DOS) to a directory called /mnt from which you can access files on floppy disks. In the first example, the /mnt directory can be read into the ext2 file system, while the second reads floppies written in MS-DOS format. To read the contents of the floppy drive, which is now /mnt you can type:
cd /mntthen, ls or less filename.
In a similar manner, you can mount your other floppy drives, tape drives, CD-ROMs or other read/write devices. These devices can be unmounted using the command:
or umount /dev/whateveryoumounted<\n>.
Here are a few tips that can make your Linux life a little easier.
Suppose you make a typo in your command that you don't catch until after you press enter. If the environment variable FCEDIT is set to emacs (default for the bash shell), you can correct it without retyping the whole command by tapping the up arrow key to bring back the previous command for editing with emacs. In fact, you can use the up arrow key to go up through the history file and the down arrow to come back down if you go too far. If FCEDIT is set to vi (default for the ksh shell), press ESC (escape key) then use k to go up the history file and j to go down, and of course, use vi to edit the faulty command.
To change back to a directory you have just left or to scan subdirectories, use:
in the following manner. Change from your /home directory to the main trunk directory:
cd /then, to look at the top level of each directory, for instance, type:
cd usrthen ls. If you didn't find what you were looking for, type:
and you will find yourself at the trunk / again. Unfortunately, you can only go one layer deep, but it is still useful when you install a source package and want to check out the contents of each of the subdirectories.
Sometimes, at least at first, you may not know how to stop a program or process that's running, but you are unwilling to let it slowly eat up your memory or CPU overhead. To get rid of it, first find its pid (process identification) number by typing:
to get a list of all running processes. Make note of the pid number and type:
killThere is another way to do this that is actually easier. Browse through the LSM (Linux Software Map) for a utility, actually a nicety, called die-1.1. You can unpack this utility into a directory or use installpkg dopkg or whatever your single package installation utility is. Then look for the /die-1.1 and cd to it. This directory contains a couple of files: a source file called die11.c and a documentation file called die.doc.
Assuming that you have installed the GCC compiler, just type:
gcc -o die die11.c
hit ENTER, and presto, you've compiled the die utility. Just mv it to a directory in your path, and if you like, mv the die .doc to /usr/doc or somewhere it can be with other help text friends (but not man pages, they'll pick on it unmercifully). Now, next time you're in a quandary about how to gun down a process just type:
dieand it will do the deed without having to look up the pid number. To find out more about die just type:
diewith no argument and it will give you a summary of the commands you can try the up arrow keys on.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Client-Side Performance
- Peppermint 7 Released
- Sony Settles in Linux Battle
- Libarchive Security Flaw Discovered
- Maru OS Brings Debian to Your Phone
- Git 2.9 Released
- Snappy Moves to New Platforms
- The Giant Zero, Part 0.x
- Profiles and RC Files
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide