UNIX trics: Difference between revisions
Line 22: | Line 22: | ||
If running the bashrc is not possible because the error {{FormFCT|9|red|bash: /home/chris/.bashrc: Permission denied}} occurs | If running the bashrc is not possible because the error {{FormFCT|9|red|bash: /home/chris/.bashrc: Permission denied}} occurs | ||
perform the following statement:<br>{{GuiKeyword|chmod 740 ./.bashrc}} or better {{GuiKeyword|chmod o+rwx ./.bashrc}}, see below for detailed info. | perform the following statement:<br>{{GuiKeyword|chmod 740 ./.bashrc}} or better {{GuiKeyword|chmod o+rwx ./.bashrc}}, see below for detailed info. | ||
An alternative PS1 prompt: | |||
\w:\u\$ | |||
This will produce outcome like the current directory and username: | |||
/Projects/xx/yy:UserName$ | |||
See for more http://bash.cyberciti.biz/guide/Changing_bash_prompt. | |||
=== ls & chmod === | === ls & chmod === |
Revision as of 08:40, 4 June 2013
Some useful tips and tricks for UNIX.
Command Reference
The UNIX Command Reference has nearly all the frequently used UNIX commands.
Profile
If you like a prompt like:
HarmFrielink@L3AFY65 ~
$
Place this PS1 into the .bashrc file (UNIX Escape Sequence)
Together with the folowing options:
PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ " alias dir='ls --color=auto --format=vertical' # DOS dir alias ll='ls -l --group-directories-first --color' # long list alias la='ls -Al --group-directories-first --color' # all but . and .. alias l='ls -CF' #
If running the bashrc is not possible because the error bash: /home/chris/.bashrc: Permission denied occurs
perform the following statement:
chmod 740 ./.bashrc or better chmod o+rwx ./.bashrc , see below for detailed info.
An alternative PS1 prompt:
\w:\u\$
This will produce outcome like the current directory and username:
/Projects/xx/yy:UserName$
See for more http://bash.cyberciti.biz/guide/Changing_bash_prompt.
ls & chmod
The meaning of the different colors in ls --color in combination with the drwxrwxrwx :
File Type | Owner Access | Group Access | Other Access | ||||
---|---|---|---|---|---|---|---|
- d |
regular file directory |
r w x |
read write execute |
r w x |
read write execute |
r w x |
read write execute |
The following example shows a directory for which the owner has read/write/execute access, the group has read/execute access, and all others have no access:
drwxr-x---
File Access Descriptor | |||||
---|---|---|---|---|---|
Entity | Operator | Access Rights | |||
u g o a |
user(owner) group others all of the above |
+ - = |
grant revoke set |
r w x |
read write execute |
chmod examples | |
---|---|
Command | Description |
chmod u+rwx,g-rxw,o-rwx hosts | Add all rights for owner and revoke all rights for group and others on the "hosts" file. |
chmod g+r hosts | Now add read access for the group. |
Escape Sequence
Errors
If you get the error The procedure entry point sigset could not be located in the dynamic link library cygwin1.dll install cygwin again.
UNIX Tutorials
- BASH Scripting Guide for beginners
- UNIX tutorial, a good start