Sie sind auf Seite 1von 4

Linux Command Summary

Basic Information
The following commands can be used to find out basic information about the machine
you are using.
date Print the time and date.
cal Print a calendar.
who Show who is currently logged on to this machine.
last Show who has logged in recently.
uptime Show how long the machine has been up.
top Show the machine load and processes.
(Type “q” to exit from top.)

Getting Help
The following commands give access to a variety of on-line help systems.
man cmd The official on-line manual.
man -k topic Keyword search of the manual.
apropos topic Equivalent to man -k.
gnome-help The (graphical) Gnome help system.
info The Gnu info system.
The manual (either using the man command or through the gnome-help interface)
should be the first place you use to obtain information about the system. The info
command will get you access to a set of longer documents about some of the installed
software.

The File System


The Linux file system is organised as a set of nested containers called directories (or
folders). Each directory can be used to hold other directories or files. The position
of each file or directory is described by its pathname. This is a sequence of names
separated by slashes (/).
/dir1 /dir2 /. . . /dirn /filename
At any given time there is a current working directory and simple names are taken
to refer to files within this directory. File names can also be specified relative to the
current directory using . to indicate the current directory and .. to indicate “up one
level” from the current directory.

1
There are a large number of commands related to obtaining information about files
and directories in the system.
pwd Print the path name of the current directory.
cd dir Change the working directory to the one specified.
ls List the names of the files in the current directory.
ls -l List file names with additional information.
du Report disk usage (in 1 kilobyte blocks).
quota Report on disk usage and quota.
wc Report lines, words and characters in a file.
wc -l Report the number of lines in a file.
wc -w Report the number of words in a file.

Copying, Moving and Removing Files


A number of commands can be used to copy and move files. Most of the file names
here can be simple names or either relative or full pathnames.
cp old new Make a copy of a file under a new name.
mv old new Rename a file.
cp files dir Copy the specified files to the given directory.
mv files dir Move one or more files to a directory.
rm files Remove the named files.
rmdir dir Remove the named (empty) directories.
rm -r files Recursively remove the named files and directories.

Redirecting Output
The output of Linux commands can be redirected to and from files.
cmd > file Redirect output to the given file (overwrites).
cmd >> file Append output to the given file.
cmd < file Take input from the given file.
cmd1 | cmd2 Output from one program into another (a “pipe”).
The use of pipes is what makes Linux such a flexible system. For example,
who | wc -l
will count the number of users currently logged in.

Basic Operations on Files


cat Concatenate and print files (on screen).
tr Transliterate character sets.
grep Print lines matching a pattern.
sort Sort the lines of a file.
head First few lines of a file.
tail Last few lines of a file.
more Page at a time display.
less Alternative page at a time display.

2
These programs can be combined using the redirection operations above. Here is how
to concatenate three files together.
cat file1 file2 file3 > combined
Here is how to convert all uppercase letters in a file to lower case.
tr [A-Z] [a-z] mixed > lcase
Here is to find the lines in a file which contain the word Unix
grep Unix file
Find the number of lines which contain the word Unix.
grep Unix file | wc -l

Pattern Matching with Grep


The name grep is a contraction of get regular expression and print. Grep uses patterns
which are known as regular expressions. Examples of regular expressions are.
. Any single character.
\c A literal c character.
[. . . ] Matches any one of the characters in the brackets.
[c1 -c2 ] Any character in the range c1 −c2 .
[ˆc1 -c2 ] Any character not in the range c1 −c2 .
ˆ The start of a line.
$ The end of a line.
expr* Matches zero or more copies of expr.
expr1 expr2 Matches the first expression followed by the second.
expr1 |expr2 Matches either the first or second expression.
(. . . ) Parentheses can be used for grouping.
Some examples:
ˆ$ Empty lines.
ˆSTART$ The word START on a line by itself.
ˆ[0-9] Lines beginning with a digit.
function Lines containing the word function.

Office-Style Applications
There are a number of applications which provide the same kind of functionality as
Microsoft Office. Documents can be exchanged with Office if they are saved in the
correct format (e.g. .doc, .xls, . . . ). The following applications are part of the free
software Open Office suite.
oowriter Word processor.
oocalc Spreadsheet.
ooimpress Powerpoint style presentations.
oodraw Drawing program.
oomath Equation editor.

3
In addition the following applications provide useful functionality.
gnumeric Spreadsheet.
abiword Word processor.
acrobat Adobe Acrobat reader.
gsview PostScript viewer.
scribus Page layout (like Pagemaker).

Graphics Applications
gthumb Graphics viewing program.
gimp Photoshop-like graphics program.
xfig Vector-dsrawing program.

Data Processing Applications


Our systems have a number of useful data processing applications installed.
R Local statistics software.
Splus A commercial version of R.
sas A database system for corporations
which does some statistics.
perl A report generation language.
awk An older report generation language.
sed A non interactive (stream editor).

Software Development
Unix is without peer when it comes to software development. Many developers pro-
duce software by developing it under Linux and simply cross-compiling for Windows.
javac A Java compiler.
java Java runtime.
cc C Compiler.
c++ C++ compiler.
f77 Fortran77 compiler.
gfortran Fortran95 compiler.
python A hot new scripting language.
ruby A less hot new scripting language.
tcl An older scripting language.
umb-scheme A scheme (aka Lisp) interpreter.
octave A language like Matlab.
anjuta A integrated C/C++ development environment.
make A software build utility.

Das könnte Ihnen auch gefallen