linuxnewbie.org.gif
Tuesday, 12-Dec-2000 10:39:55 EST
Newbized Help Files articles discussion board bookshelf sensei's log advertising info

Basic command separation


the backslash separator (\)

Summary
Use this to write multiple lines command (if your terminal screen isn't long enough).

Example

#mount /dev/hdc \
/mnt/cdrom
#

the & (background task) separator

Summary
Normally, when you enter a command, the task runs in the foreground and you don't get the prompt back until
the program is finished. Sometimes you don't want this behavior. Especially if your task takes a lot of time
and doesn't have any interaction with the user (example: updatedb). The answer is to run the program in the
background. By placing a "&" last in your command you achieve this effect.

Example
#sleep 10
<Wait ten seconds>
#
#sleep 10 &
[1] 13533 <-- this is the PID (ProcessID) of the process you just put in the background.
# Your prompt returns immediately
#sleep 10 & sleep 15 &
[1] 13534 <- starts both commands simultaneously in the background in order.
[2] 13535 <- this is the sleep 15 commands PID
#

the | (pipe) separator

Summary
A really useful separator. It directs the output of one command to the next. This is very useful when you want one program to work on the output of another one.

Example
# ps aux | grep ps
larson 1344 0.0 0.4 1188 584 p2 R 15:04 0:00 ps aux
larson 1345 0.0 0.3 1180 464 p2 S 15:04 0:00 grep ps
#


The example first lists all processes on the system and directs this output to the grep utility which sorts
out and displays all lines with ps in them. PS: you may not get the same output that I did, because the "grep
ps" command may or may not have been started at the time you ask for the process list.


the semicolon separator

Summary
If you want to execute more than one command in a row you can separate them with a semicolon (;)

Example
#cp /tmp/hello ; cat hello
Copies the file "hello" to the current directory and then displays it.


Table of contents

[-NHF Control Panel-]
The Linux Channel at internet.com
Linux Planet
Linux Today
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
BSD Today
Apache Today
Enterprise Linux Today
BSD Central
All Linux Devices
SITE DESCRIPTIONS
[-What's New-]
Order a Linuxnewbie T-Shirt
Easy Webcam NHF
Directory Navigation NHF
Installing Snort 1.6.3 on SuSE 6.x-7.x
Customizing vim
The SysVinit NHF
Installing ALSA for the VT82C686 integrated sound
USB Creative Video Blaster II for Linux
Configuring the Intellimouse Explorer in XFree86 V4+
The beginnings of a distro NHF
Getting Past Carnivore?
Getting and Installing PGP
Getting your ATI Rage 128 Working
How to create a multiple partition system
Using Fdisk
Introduction to Programming in C/C++ with Vim
Adding a Hard drive in Linux -- In five steps
Installing ALSA for the Yamaha DS-XG Sound Card
Getting your Diamond Rio Mp3 Player to work with Linux
Bash Programming Cheat Sheet
Installing NVIDIA Drivers for Mandrake
Setting up Portsentry
Hard Drive Speed Tweak for Linux
Sensei's Log
Chat room
Join: Linuxnewbie.org SETI Black Belts!
Send in your news
Click the image to add Linuxnewbie.org to your MyNetscape Page
[-LNO Newsletter-]

[-Archive-]
The beginnings of a distro NHF
Connecting to the Internet using KPPP
Getting your SBLive to work
Unreal Tournament NHF
LWE Day 2 Pictures
LWE Day 1 Pictures
The LNO FAQ!
WoW (Words of Wisdom)
Other sites news
What is Linux?
What is Linux? part deux (ups & downs)
Search newsgroups
The List
ALS Report
Feedback Form
jobs.linuxtoday.com.gif
Match: Format: Sort by:
Search:
Copyright © 1999 All Rights Reserved
[-Quick Links-]

Copyright 2000 internet.com Corp. All Rights Reserved. Legal Notices Privacy Policy

internet.com.gif