Monday, October 19, 2009

Linux Cheetsheet

This is a simple cheatsheet of stuff I am using a lot, administrating a CentOS4 server. Also some stuff I use with Kubuntu on my laptop.


Tar
Syntax: tar *options* *zip-file* *files to add*
Common options:
- c=create, x=extract, t=list, r=add more files to an archive
- z=Gzip
- j=bzip2
- v = dunno, but used in a lot of commands
- f=filename. Put at the end of the options


Vim
Syntax: vim *filename*
When your in VIM:
*ESC* brings you to command mode
I brings you from command mode to insert mode
:w write file from command mode
:q quit from command mode
:q! quit without saving from command mode


Find
syntax: find *folder* *options*
-name '*pattern*' - Name pattern, * is OK.
-(i)regex 'pattern' - (case insensitive)regular expression.
-size *number*[kMG][+-] - searches for files with *number* size(suffix k, M or G for kilobytes, Megabytes, Gigabytes), and if you add a + or - you will get all files larger or smaller than size respectively.


Chown/Change Owner
syntax: chown [-R] *newowner* *filenames*
The -R option makes Chown change the permission on files that are in the sub-directories of the directory that you are currently in.
*newowner* is the name or alias you want the files to change to
*filenames* are the file(s) that you want to change permissions on.

No comments:

Post a Comment