Sie sind auf Seite 1von 2

general

-------
-whoami: state the current user
-pwd: state the current directories
-man command: help
-clear: clear screen
-exit: exit terminal
-cal: calendar
-ls: list
ls -1 : list
ls -a : list hidden files

-mail:to read your email

vi editor
-------------------------
vi filename
escape: go to Exit mode
Shift+z +z: to quit
l key to move to the right side.
h key to move to the left side.
k key to move up side in the file.
j key to move down side in the file.

files & directories


-------------
-cat file: display the content of a file
-wc filename: counting words : line words characters filename

-cp filename copyname: copy filename as copyname


cp -r dir1 dir2 (copy recursevely all dir1 to dir2)
cp - i (ask before it is overwritten)

-mv filename destination: rename if it is in the same directory else it is


moved

-rm filename: remove file


rm file1 file2 file3 ...

-cd ~: go to home directory


cd ~username: go to user home directory
relative and absolute path

-mkdir dir: create directory dir


mkdir dir1 dir2: create dir1 dir2 under current directory
mkdir -p dir3/dir3 : to be able to create necessary tree

-cat > filename: create filename


start typing, when u finish press ctrl+c or ctrl+D

-more filename: To display file one full screen at a time

-cmp file1 file2: compare two files


cmp -l
cmp -i
grep
-----
-grep fox x: search for fox in file x
-grep fox x*: search for fox in all files having names like x
-grep -i: ignore case letters
-grep - w: full word
-grep -r:search in all the files under the current directory and its sub directory.
-grep -v: reverese, show not matching lines
-grep -c: count the lines that have matches
-grep -l: display file name where match occur
-grep -o
-grep -b
-grep -n

links
----------

users
----------
chmod {u|g|o|a} {+|-} {r|w|x} {filename}
To change file access permissions
u - User who owns thefile
g - Group file owner
o - User classified as other
a - All other system user

+ Set permission
- Remove permission

r - Read permission
w - Write permission
x - Execute permission

chmod u+x,g+wx,o+x myscript

To make a batch file


---------------------

to run a batch file:


-------------------
bash file
./file
sh file