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!
|Working with Command Arguments||May 28, 2016|
|Secure Desktops with Qubes: Installation||May 28, 2016|
|CentOS 6.8 Released||May 27, 2016|
|Secure Desktops with Qubes: Introduction||May 27, 2016|
|Chris Birchall's Re-Engineering Legacy Software (Manning Publications)||May 26, 2016|
|ServersCheck's Thermal Imaging Camera Sensor||May 25, 2016|
- Secure Desktops with Qubes: Introduction
- Secure Desktops with Qubes: Installation
- Working with Command Arguments
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- CentOS 6.8 Released
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- Chris Birchall's Re-Engineering Legacy Software (Manning Publications)
- ServersCheck's Thermal Imaging Camera Sensor
- Petros Koutoupis' RapidDisk
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide