Basic unix concepts: Difference between revisions
No edit summary |
|||
Line 3: | Line 3: | ||
===Where am I?=== | ===Where am I?=== | ||
* how to open a [http://en.wikipedia.org/wiki/Terminal_emulator terminal] | ====* how to open a [http://en.wikipedia.org/wiki/Terminal_emulator terminal]==== | ||
* bash vs cshell (and also tcl) are scripting languages | Click Applications --> Accessories --> Terminal | ||
* pwd | ====* bash vs cshell (and also tcl) are scripting languages==== | ||
Ubuntu comes with the BASH shell (i.e. when you open a terminal, you must type in BASH). You know this is the case because your prompt is a dollar sign ($). If you'd like to change to CSHELL, type csh, or tcsh on the command line, and you will get the carrot prompt (>). Incidentally, tcl, the scripting language of flooxs, gives you a percent (%) sign as a prompt (in case you want to test tcl commands, you can start a tcl shell by typing tclsh on the command line). Finally, the program "flooxs" gives you a flooxs prompt that looks like this: flooxs> | |||
====* pwd and `pwd` with backwards quotes==== | |||
* ls | pwd means "print working directory." If you don't know where you are, you can type pwd and your terminal will tell you. In BASH scripting language, the backwards single quote (which can be found above the "tab," next to the "1" key on your keyboard) means "execute what is inside these quotes and put the result in it's place." For example, I'm inside a certain directory and I want to set that directory as an environment variable (because maybe the path name is really long and I don't want to type it a lot), I can set it directly, or use `pwd` | ||
* cd | $ pwd | ||
* cp | /Users/Shared/FLOOXS/cur | ||
* a directory | $ export FLXSHOME=`pwd` | ||
* .. | $ echo $FLXSHOME | ||
* . | /Users/Shared/FLOOXS/cur | ||
* root directory ( | ====* ls==== | ||
* links in your ubuntu root directories for 64 bit stuff | ls stands for "list," and is used to view what's in a directory | ||
$ ls | |||
Documents Pictures flooxs Desktop | |||
$ ls Documents | |||
homework1.txt todolist.txt SPICEmanual.pdf | |||
Some good variations on this to know are "ls -a", which will show you hidden files that start with "." or "..", and "ls -la", which will show you permissions on your files and directories. | |||
====* cd - change directory==== | |||
$ cd ;#changes to your home directory | |||
$ cd ~ ;#also changes to your home directory | |||
$ cd dirname/ ;#change to a directory just below the one you're in | |||
$ cd /full/path/name | |||
$ cd .. ;#go up 1 directory | |||
$ cd - ;#go to the last directory you were in | |||
$ cd / ;#go to the root directory | |||
====* cp==== | |||
cp stands for "copy," use to copy filename1 to filename2 | |||
$ cp filename1.whatever filename2.whatever | |||
====* What is the difference between a "directory" and a "folder"?==== | |||
Nothing | |||
====*some useful symbols for important directories==== | |||
*.. - This symbol means "one directory up" | |||
* . - This symbol means "this directory I'm currently in" | |||
* ~ - This symbol means "my home directory" (probably /home/username on your personal machine) | |||
* / - This symbol means "the root directory" | |||
The root directory is the top directory of your computer. Note, there's a difference between these 2: | |||
$ cd dir/ | |||
$ cd /dir/ | |||
The last forward-slashes are optional (it merely means that what you've typed is a directory). The first forward-slash with nothing preceding it means "the root directory." So, in the first case, you will go down 1 level to a directory named "dir". In the second case, you will first go to the "root" directory, and then go down 1 more level to a directory name "dir". | |||
====* links in your ubuntu root directories for 64 bit stuff==== | |||
Your root directory has some important directories in it. For example, | |||
$ cd / | |||
$ ls | |||
bin dev lib32 tmp | |||
boot etc lib64 usr | |||
cdrom home lib | |||
If you're confused about whether you should be using or linking your flooxs libraries to lib, lib32, or lib64, just use "lib," since what's in there is linked to whatever is the default (in my case, lib files are really just links to lib64 files). | |||
===Who am I?=== | ===Who am I?=== |
Revision as of 22:11, 9 July 2010
Of course there are great guides to Linux and Unix out there. Here I've tried to just explain the symbols, programs, and concepts that I had to learn in order to install flooxs.
Where am I?
* how to open a terminal
Click Applications --> Accessories --> Terminal
* bash vs cshell (and also tcl) are scripting languages
Ubuntu comes with the BASH shell (i.e. when you open a terminal, you must type in BASH). You know this is the case because your prompt is a dollar sign ($). If you'd like to change to CSHELL, type csh, or tcsh on the command line, and you will get the carrot prompt (>). Incidentally, tcl, the scripting language of flooxs, gives you a percent (%) sign as a prompt (in case you want to test tcl commands, you can start a tcl shell by typing tclsh on the command line). Finally, the program "flooxs" gives you a flooxs prompt that looks like this: flooxs>
* pwd and `pwd` with backwards quotes
pwd means "print working directory." If you don't know where you are, you can type pwd and your terminal will tell you. In BASH scripting language, the backwards single quote (which can be found above the "tab," next to the "1" key on your keyboard) means "execute what is inside these quotes and put the result in it's place." For example, I'm inside a certain directory and I want to set that directory as an environment variable (because maybe the path name is really long and I don't want to type it a lot), I can set it directly, or use `pwd`
$ pwd /Users/Shared/FLOOXS/cur $ export FLXSHOME=`pwd` $ echo $FLXSHOME /Users/Shared/FLOOXS/cur
* ls
ls stands for "list," and is used to view what's in a directory
$ ls Documents Pictures flooxs Desktop $ ls Documents homework1.txt todolist.txt SPICEmanual.pdf
Some good variations on this to know are "ls -a", which will show you hidden files that start with "." or "..", and "ls -la", which will show you permissions on your files and directories.
* cd - change directory
$ cd ;#changes to your home directory $ cd ~ ;#also changes to your home directory $ cd dirname/ ;#change to a directory just below the one you're in $ cd /full/path/name $ cd .. ;#go up 1 directory $ cd - ;#go to the last directory you were in $ cd / ;#go to the root directory
* cp
cp stands for "copy," use to copy filename1 to filename2
$ cp filename1.whatever filename2.whatever
* What is the difference between a "directory" and a "folder"?
Nothing
*some useful symbols for important directories
*.. - This symbol means "one directory up" * . - This symbol means "this directory I'm currently in" * ~ - This symbol means "my home directory" (probably /home/username on your personal machine) * / - This symbol means "the root directory"
The root directory is the top directory of your computer. Note, there's a difference between these 2:
$ cd dir/ $ cd /dir/
The last forward-slashes are optional (it merely means that what you've typed is a directory). The first forward-slash with nothing preceding it means "the root directory." So, in the first case, you will go down 1 level to a directory named "dir". In the second case, you will first go to the "root" directory, and then go down 1 more level to a directory name "dir".
* links in your ubuntu root directories for 64 bit stuff
Your root directory has some important directories in it. For example,
$ cd / $ ls bin dev lib32 tmp boot etc lib64 usr cdrom home lib
If you're confused about whether you should be using or linking your flooxs libraries to lib, lib32, or lib64, just use "lib," since what's in there is linked to whatever is the default (in my case, lib files are really just links to lib64 files).
Who am I?
- root is a person (sudo)
Viewing and Editing Files
- more, less, and cat
- gedit comes with ubuntu
- the ampersand (&) symbol
Finding Files or Text in Files
- the find program
- grep
- the asterisk symbol (*)
Executing Programs
- execute an executable with ./
- execute programs by typing their names
Know Your Computer
- 64 bit vs 32 bit
- how do I know what architecture I have?
- what version of Ubuntu am I running?
Stuff You'll be Doing A Lot
- environment variables
- comments in scripts (#) vs comments in c++ (//), a programing language
- download, configure, and compile (make)