|
The Linux Operating System: Key Concepts |
| Concept:1. | Compiling a program
- gcc file1.c: Compiles source file file1.c and creates executable file a.out.
- gcc -c file1.c: Compiles source file file1.c and creates an object file file1.o which is not an executable proram.
- gcc file2.c file1.o: Compiles source file file2.c and links it with object file file1.o to create an executable file a.out.desc
|
| Concept:2. | Basic Linux Commands (group 1)
- pwd: displays the name of the current working directory
(print working directory)
- ls: lists the files in the current directory
- ls -l : list the files in the current directory - using the long list format that will include file permissions and data and time stamps.
- ls -lrt: list the files in the current directory using the long list format (-l) and will display the names in reverse (-r) chronological order (-t)
- ls *.c : list all of the files that end with .c
- ps: process status: shows a list of running processes
- mkdir backup: makes a directory named backup that will be a subdirectory of the current working directory.
- cp *.c backup: copies all files that end with .c into a subdirectory named backup.
- cd backup: changes the current working directory to a subdirectory named backup.
- cd .. : changes the current working directy to the parent of the current directory.
|
| Concept:3. | Basic Linux Commands (group 2)
- cal: displays a calendar of the current month.
- cat lab_1.c: displays the contents of file lab_1.c
- clear: clears the current screen, brining the cursor to the top left of the window.
- echo computer science: the echo command repeats its parameter to the console. In this case the output string "computer science" will be sent to the console, without the quotes.
- env: Displays a list of environment variables that have been set for your session. This will include lists of directories to search when you issue a command, information about the terminal you are using, information about the bash shell you are using, and more information that supports your session.
- history: displays a list of recently executed bash commands
- more lab_1.c: displays the contents of file lab_1.c one page at a time
- man more : displays the help page for the more command. man is short for manual, when you need help with a linux command, try using the man pages.
- man man: displays the help page for the man command.
- cp lab_1.c TestCopy.c
mv TestCopy.c test_move.c: makes a copy of the file lab_1.c named TestCopy.c and then
renames the copy to test_move.c.
|
| Concept:4. | Running a Program
- ./a.out: executes program a.out which is located in your current working directory.
- a.out: executes a program named a.out that is anywhere in your search path.
- which a.out: displays the path name for a.out, this is good when you have a long search path and there could be more than one program with the same name. This command will tell you which program named a.out will be executed.
|
| Concept:5. | Lunix Command Group 3
(taken from Linux Lab 2)
- bash: Is one of the many command shells available in Linux, and the one used by the Cloud 9 Integrated Development Environment
- sed: a stream editor, processes text editing on input files
- cut: parses text input files based on field delimiters or character positions
- wc: counts lines, words of a text file
- head: displays the fist n lines of a text file, n = 10 by default
- tail: displays the last n lines of a text file, n = 10 by default
- sort: sorts the contents of a text file
- uniq: removes duplicate lines from a sorted text file
- hexdump: displays the hexadecimal values for the contents of an input file
- od: displays the octal values for the contents of an input file
|