Introduction to Linux


Contents

Basic commands for your research
Useful Linux commands
Some of the general tips for Linux commands
How to use grep, find , wc, and diff commands
How to extract and archive files
How to use other's Linux...when you do not have your own Linux system.
Troubleshootings


Basic commands for your research

Although most of the commands can be operated by the graphical interface, (e.g. double clicking and dragging icons) you still have to know how to command in terminal.

Start up terminal and let's make sure what you have. Type "ls", which expresses list and shows the files in the directory.
$ ls
some.txt
The starting up directory is your home. Now, let's create a directory there by commanding "mkdir" with your new directory name.
$ mkdir mydirectory
Suppose you have a program file in the home directory. Then, you copy it into the new directory you made above.
$ cp program.c mydirectory/
If you want to change the name of the file in the directory, type following:
$ cp program.c mydirectory/myprog.c
If you want to move the file into the other directory, use "mv" command. For example,
$ mv program.c mydirectory/
The command, mv, is also used as changing the names of a file as follows:
$ mv program.c old_program.c
You should now know how to change directories. In terminal, you can only operate files in the directory. Let's go to the new directory using "cd" command.
$ cd mydirectory
Then, you will see:
@mydirectory:~$
This shows that you are in the directory. Make sure if you have that file in it by using "ls" command. If you want to go out of the directory, type following:
$ cd ..
Don't forget a space between "cd" and ".." Then, you can compile the code as follows:
$ gcc myprog.c
Don't type gcc "myprog.c"! The double quotation could mess up your part of system. If you don't have any error, there will be no message in terminal and check if there is the executable file, a.out. Run the file as follows:
$ ./a.out
If the code generates a data file, say mycode.dat, you can plot by using gnuplot:
$ gnuplot
#
#
plot "mycode.dat"
The detailed instruction of gnuplot is here.


Back to Electronics Page

Back to Hiro's Physics Main