Sie sind auf Seite 1von 2

Basic UNIX commands

Ls To list the files

Ls-l To list the files in a long format (+size,


last modified, its owner)
Ls-a Lists all the files (by size, by date)

More + example Shows the first part of the screen, to


show more hit the spacebar
/pattern T

Emacs + example An editor that lets you create and edit a


file.
cd path Changes the current working directory

ls path Shows a listing of a specific file or


directory
pwd Shows the user’s current working
directory.
cp Copies a file.

mv Moves (renames) a file or directory.


Mkdir path Creates a new directory

.. Means ‘the directory above the current


one’
. On its own means ‘the current
directory’.
* Matches zero or more characters in a
filename *.txt matches all files ending in
txt
cat Displays the contents of a file

head Displays the first 10 lines of its input.

tail Displays the last 10 lines of its input.

sort Used to sort a file

wc counts lines, words, and characters in

command > file redirects a command’s output to a file


(overwriting any existing content).
command >> file Appends (add something to the end of a
written document) a command’s output
to a file.
< Redirects input to a command

first | second Is a pipeline: the output of the first


command is used as the input to the
second.
Ctrl-R To search through the previously
entered commands.
history to display recent commands

!number To repeat a command by number.

1
bash filename runs the commands saved in a file.

find finds files with specific properties that


match patterns.
grep selects lines in files that match patterns.

--help is a flag supported by many bash


commands, and programs that can be
run from within Bash, to display more
information on how to use these
commands or programs.
man command displays the manual page for a given
command.
$(command) inserts a command’s output in place.

$1, $2 refer to the first command-line


argument, the second command-line
argument, etc.

Das könnte Ihnen auch gefallen