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.
Practical Task Scheduling Deployment
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.View Now!
|The Firebird Project's Firebird Relational Database||Jul 29, 2016|
|Stunnel Security for Oracle||Jul 28, 2016|
|SUSE LLC's SUSE Manager||Jul 21, 2016|
|My +1 Sword of Productivity||Jul 20, 2016|
|Non-Linux FOSS: Caffeine!||Jul 19, 2016|
|Murat Yener and Onur Dundar's Expert Android Studio (Wrox)||Jul 18, 2016|
- Stunnel Security for Oracle
- The Firebird Project's Firebird Relational Database
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- SUSE LLC's SUSE Manager
- Managing Linux Using Puppet
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- Doing for User Space What We Did for Kernel Space
- Google's SwiftShader Released
- SuperTuxKart 0.9.2 Released
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