Size: 20642
Comment:
|
Size: 24797
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 103: | Line 103: |
---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- {{{ ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- |
|
Line 179: | Line 192: |
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls: * '''`ls /`''' will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words. * '''`ls -l`''' will give you a more detailed listing. * '''`ls -a`''' will list all files, even hidden(files starting with .) files. * '''`ls -h`''' will give file sizes in KB/MB/GB, instead of mere Bytes. Listing current directory: {{{ dud@shadowplay:~ $ pwd /home/dud }}} Changing directory: {{{ dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root }}} You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms. Echoing: {{{ dud@shadowplay:~ $ echo "Hello World" Hello World }}} A very useful command, which will quite simply echo back what you give it as arguments. /!\ It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on! List content of a file: The command cat will print out content of '''text''' files to your terminal. The file file1.txt had a poem as we saw. ;) Copying a file: {{{ dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt ---- /!\ '''Edit conflict - other version:''' ---- }}} {{{ ---- /!\ '''Edit conflict - your version:''' ---- }}} {{{ ---- /!\ '''End of edit conflict''' ---- Roses are red. Violets are blue, and you have the bird-flue! }}} ---- /!\ '''Edit conflict - other version:''' ---- |
---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- }}} ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls: * '''`ls /`''' will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words. * '''`ls -l`''' will give you a more detailed listing. * '''`ls -a`''' will list all files, even hidden(files starting with .) files. * '''`ls -h`''' will give file sizes in KB/MB/GB, instead of mere Bytes. Listing current directory: {{{ dud@shadowplay:~ $ pwd /home/dud }}} Changing directory: {{{ dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root }}} You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms. Echoing: {{{ dud@shadowplay:~ $ echo "Hello World" Hello World }}} A very useful command, which will quite simply echo back what you give it as arguments. /!\ It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on! List content of a file: The command cat will print out content of '''text''' files to your terminal. The file file1.txt had a poem as we saw. ;) Copying a file: {{{ dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- }}} {{{ ---- /!\ '''Edit conflict - your version:''' ---- }}} {{{ ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- }}} {{{ ---- /!\ '''Edit conflict - your version:''' ---- }}} {{{ ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''End of edit conflict''' ---- Roses are red. Violets are blue, and you have the bird-flue! }}} ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- |
Line 290: | Line 344: |
---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- |
|
Line 338: | Line 404: |
The command cat will print out content of '''text''' files to your terminal. The file file1.txt had a poem as we saw. ;) Copying a file: {{{ dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue! }}} ---- /!\ '''Edit conflict - other version:''' ---- |
---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- The command cat will print out content of '''text''' files to your terminal. The file file1.txt had a poem as we saw. ;) Copying a file: {{{ dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue! }}} ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- |
Line 466: | Line 556: |
---- /!\ '''Edit conflict - other version:''' ---- |
|
Line 521: | Line 613: |
---- /!\ '''Edit conflict - your version:''' ---- How to use the system manual: {{{ dud@shadowplay:~ $ man ls }}} I will now list a few of the basic and most useful commands that comes with Ubuntu Linux. /!\ Remember to type the commands exactly as they are written, and end with pressing the Enter key! Listing files: ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls: * '''`ls /`''' will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words. * '''`ls -l`''' will give you a more detailed listing. * '''`ls -a`''' will list all files, even hidden(files starting with .) files. * '''`ls -h`''' will give file sizes in KB/MB/GB, instead of mere Bytes. Listing current directory: {{{ dud@shadowplay:~ $ pwd /home/dud }}} Changing directory: {{{ dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root }}} You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms. Echoing: {{{ dud@shadowplay:~ $ echo "Hello World" Hello World }}} A very useful command, which will quite simply echo back what you give it as arguments. /!\ It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on! List content of a file: The command cat will print out content of '''text''' files to your terminal. The file file1.txt had a poem as we saw. ;) Copying a file: {{{ dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue! }}} ---- /!\ '''End of edit conflict''' ---- |
ContentsBRTableOfContents |
Note that this is still a work in progress. If you're just looking for a basic introduction to the Linux command line, please see BasicCommands.
Introduction
Even though Ubuntu is the newbie friendly and polished graphical distribution, there are still situations when a serious amount of time and mouse-clickage can be spared by typing a bit. I don't think this is a bad thing at all, no matter what you do Linux has one of its real strengths in the Command Line!
What is it?
A Command Line is in all simplicity a user interface which is based on lines of commands. You can say that it is a textual direct serial processor. Most commonly, the user interacts directly with the computer by typing one line (although it can be more than one), to which triggers actions from the computer based on the syntax of the current processor.BR Before everything gets too complicated, we can quite simply move on. The impatient can move right on to the Basic Usage section.
History
In the early days of computers there was only the Command Line. The concept of a Graphical User Interface (GUI) to which most GUI are modelled after today were invented by engineers at Xerox's Palo Alto Research Center (PARC). A bit later, Apple paid a whole bunch of money to be allowed to "study" their GUI idea. And, after a while Apple had their own GUI.
Not until 1986 did UNIX get its first GUI, developed by the MIT Project. They named it X. Linux however, had to wait ten more years before XFree86 were released. XFree86 was, and is even today, a free adoptation of the original X server.
As mentioned earlier, the CLI (Command Line Interface) were the only way to communicate with computers before the GUI was invented. In 1969, Bell Telephone Laboratories released V1 of the UNIX Timeshare System. UNIX had a shell called sh, which was the only means of communicating with the computer, and it would stay that way for quite some time.
Later on there came dervatives of UNIX. HP-UX, 1BSD, Solaris, OpenVMS, IRIX, SCO XENIX, etc etc... As more time progressed, GNU/Linux emerged. However, the history of Linux itself is way off the scope for this HOWTO. As time progressed alternative CLI to sh emerged. zsh, ksh, bourne shell, etc etc...
POSIX
The wikipedia defines POSIX as the following;
"POSIX is the collective name of a family of related standards specified by the IEEE to define the application program interface (API) for software designed to run on variants of the Unix OS. They are formally designated as IEEE 1003 and the international standard name is ISO/IEC 9945. The standards emerged from a project, begun circa 1985. The term POSIX was suggested by Richard Stallman in response to an IEEE request for a memorable name; before that the standards effort was called IEEE-IX. POSIX is a near acronym for Portable Operating System Interface, with the X signifying the Unix heritage of the API."
This sounds fancy and all, but to stay rather concise, it will suffice to say that POSIX is the underlying standards and functionality of how your CLI responds and interacts.
Advantages of using the commandline
So, this all sounds very dull and boring. Not to mention hard work and thinking?BR Well, it isn't really. It's quite easy once you understand the basics.
Some advantage of using the commandline are:
- save you time.
- can help when you are unable to use the GUI, such as a system crash or a configuration issue.
- enable you to use Linux in ways that using a GUI exclusively can not.
For example you have been called by the systems administrator that you have used too much space. You want to quickly work out where the most space is used, using a graphical interface start you timer - go. Now go to a command line and type du | sort -n we will describe more later. It is faster to do some things on the command line and sometimes easier for graphical.
Prerequisites
This assumes that you are running any version of Ubuntu Linux.BR Desire to learn the inner working of Ubuntu Linux
How to invoke it
For the purpose of this document we will invoke the command line interface from the Desktop.BR
GNOMEBR Applications | Accessories | TerminalBR
KDEBR
XFCEBR
Basic structure and concepts
The first thing that you should notice is something like:
dud@shadowplay:~ $ or [dud@shadowplay ~]$
What you see here is called the prompt. It signifies that the computer is ready and awaiting user input. In my case, dud is the user that I'm logged in as. shadowplay is the computers hostname, and ~ is the current directory.
Concepts:
- A terminal is a "physical"(direct) interface to your Linux Operating System.
- A terminal emulator is what we'll be using here. This is a CLI wrapped within your running GUI. Any applications running in a terminal emulator will be killed if you close the terminal emulator.
- A shell is an interpeter for your terminal.
- A command is usually a small utility which the shell will execute for you.
- Output is what a command returns, most often this is returned on the terminal.
- Input is the arguments or data that any given command will take. Input will change the way a given command acts.
- A process is a command/application that is currently running on your computer. It doesn't actually have to be active, it can sleep or be in a number of states.
Basic Usage
This section will try to give you a good rundown of the basic usage for the bash shell, which is the default shell in ubuntu.
Syntax
The command syntax is will vary with each command that can be used on the command line. The best way to see the specific syntax of a command is to use the system manual.
The simpliest way to use some commands is to type just the command.BR
command
Example:
---- /!\ '''Edit conflict - other version:''' ---- {{{ ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ---- {{{ ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''End of edit conflict''' ---- dud@shadowplay:~ $ ls file1.txt file2.pdf file3.mp3 file1.pdf another_file.txt Yet-Another_file.txt file-with_other-NAME.TXT
The next way a command can be used is with 1 or more arguments.BR
command <argument>
Example:
dud@shadowplay:~ $ cat file1.txt Roses are red. Violets are blue, and you have the bird-flue!
How to use the system manual to get info on the command ls:
dud@shadowplay:~ $ man ls
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file: The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt
Edit conflict - other version:
}}}
Edit conflict - your version:
End of edit conflict
Edit conflict - other version:
Edit conflict - other version:
}}}
Edit conflict - your version:
End of edit conflict
Edit conflict - your version:
End of edit conflict
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file: The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt ---- /!\ '''Edit conflict - other version:''' ---- ---- /!\ '''Edit conflict - other version:''' ----
---- /!\ '''Edit conflict - your version:''' ----
---- /!\ '''End of edit conflict''' ---- ---- /!\ '''Edit conflict - your version:''' ---- ---- /!\ '''Edit conflict - other version:''' ----
---- /!\ '''Edit conflict - your version:''' ----
---- /!\ '''End of edit conflict''' ---- ---- /!\ '''End of edit conflict''' ---- Roses are red. Violets are blue, and you have the bird-flue!
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - other version:
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - your version:
End of edit conflict
I will now list a few of the basic and most useful commands that comes with Ubuntu Linux. Remember to type the commands exactly as they are written, and end with pressing the Enter key!
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file:
The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue!
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - other version:
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - your version:
End of edit conflict
How to use the system manual:
dud@shadowplay:~ $ man ls
I will now list a few of the basic and most useful commands that comes with Ubuntu Linux. Remember to type the commands exactly as they are written, and end with pressing the Enter key!
Listing files:
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file:
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - other version:
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - your version:
End of edit conflict
The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue!
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - other version:
Edit conflict - other version:
Edit conflict - your version:
End of edit conflict
Edit conflict - your version:
End of edit conflict
How to use the system manual:
dud@shadowplay:~ $ man ls
I will now list a few of the basic and most useful commands that comes with Ubuntu Linux. Remember to type the commands exactly as they are written, and end with pressing the Enter key!
Listing files:
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file:
The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue!
How to use the system manual:
dud@shadowplay:~ $ man ls
I will now list a few of the basic and most useful commands that comes with Ubuntu Linux. Remember to type the commands exactly as they are written, and end with pressing the Enter key!
Listing files:
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file:
The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue!
Edit conflict - other version:
How to use the system manual:
dud@shadowplay:~ $ man ls
I will now list a few of the basic and most useful commands that comes with Ubuntu Linux. Remember to type the commands exactly as they are written, and end with pressing the Enter key!
Listing files:
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file:
The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue!
Edit conflict - your version:
How to use the system manual:
dud@shadowplay:~ $ man ls
I will now list a few of the basic and most useful commands that comes with Ubuntu Linux. Remember to type the commands exactly as they are written, and end with pressing the Enter key!
Listing files:
ls will default to listing your current directory, and sorting by alphabetical order. It will also be quite sparse about the information it returns. Common arguments for ls:
ls / will return the file listing for directory /. If ls is given one argument, it will take that as the directory it should work on. It will not use your current working directory in other words.
ls -l will give you a more detailed listing.
ls -a will list all files, even hidden(files starting with .) files.
ls -h will give file sizes in KB/MB/GB, instead of mere Bytes.
Listing current directory:
dud@shadowplay:~ $ pwd /home/dud
Changing directory:
dud@shadowplay:~ $ pwd /home/dud dud@shadowplay:~ $ cd /root/ dud@shadowplay:~ $ pwd /root
You can see how pwd first lists /home/dud as current directory, then cd changes it to /root/. Which pwd confirms.
Echoing:
dud@shadowplay:~ $ echo "Hello World" Hello World
A very useful command, which will quite simply echo back what you give it as arguments. It's important to note that although this works without the quotes, it's a very good practise to start using quotes as you'll be needing that often later on!
List content of a file:
The command cat will print out content of text files to your terminal. The file file1.txt had a poem as we saw.
Copying a file:
dud@shadowplay:~ $ cp file1.txt file1_copy.txt dud@shadowplay:~ $ cat file1_copy.txt Roses are red. Violets are blue, and you have the bird-flue!
End of edit conflict
Environment
Special variables. PATH, PS1, ...
Manipulating Variables
Simple scripting
Further reading
http://rute.2038bug.com/index.html.gz