faqts : Computers : Operating Systems : Linux : Shell Commands

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 14 people (79%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

Operating system: Linux: What is the command line separator in Linux? [; / alias]

Feb 23rd, 2004 05:55
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 22 November 2003 - 06:32 pm -------------------

Operating system: Linux: What is the command line separator in Linux? 
[; / alias]

---

This is the semi colon character:

;

---
---

So you can use this semi colon character to separate two or more
commands on the command line in a console, and this commands
are then executed sequentially.

---
---

So in general you use:

<your command 1> ; <your command 2> ; <your command 3> ; ... ; <your 
command last>

---
---

Note: remember to put spaces between the command and the semi colon.

---
---

This comes handy when you are defining aliases, which are usually 
oneliners.
So with this separator you can put more than one commands on one line.

---
---

e.g. this will show the content of the current directory, then switch 
to the root directory,
so 2 commands:

 ls ; cd /

---

e.g. this will show the content of the current directory, then switch 
to the home directory,
so 2 commands:

 ls ; cd /home

---

e.g. this will show the date, then the content of the current 
directory, so 2 commands:


 date ; ls

---

e.g. this will show the date, then the content of the current 
directory, then my current login,
so 3 commands:


 date ; ls ; whoami

---
---

Tested successfully in:

Linux Debian v3

Linux Mandrake v9

Linux Red Hat v9

Linux Slackware v9

Linux SuSE v9

Linux TurboLinux v8

---
---

Internet: see also:

---

Linux: Alias: Operation: Create: How to define an alias?
http://www.faqts.com/knowledge_base/view.phtml/aid/24510/fid/107

----------------------------------------------------------------------