Some useful tips and tricks for UNIX.
The UNIX Command Reference has nearly all the frequently used UNIX commands.
If you like a prompt like:
Place this PS1 into the 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:
or better , see below for detailed info.
An alternative PS1 prompt:
This will produce outcome like the current directory and username:
See for more http://bash.cyberciti.biz/guide/Changing_bash_prompt.
ls & chmod
The meaning of the different colors inin combination with the :
|File Type||Owner Access||Group Access||Other Access|
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:
|File Access Descriptor|
all of the above
|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.|
If you get the error The procedure entry point sigset could not be located in the dynamic link library cygwin1.dll install cygwin again.
SSH Keep Alive
When I close my MacBook with an active SSH session in Terminal and then wake it up, the prompt goes unresponsive. In about five minutes it says
Write failed: Broken pipe
For keeping the connection alive, you can check in /etc/ssh_config the line where it says ServerAliveInterval, that tells you how often (in seconds) your computer is gonna send a null packet to keep the connection alive. If you have a 0 in there that indicates that your computer is not trying to keep the connection alive (it is disabled), otherwise it tells you how often (in seconds) it is sending the aforementioned packet. Try putting 120 or 240, if it is still killing your connection, you can go lower, maybe to 5, if with that number it doesn't happen, maybe it is your router who is dumping the connection to free memory.
For killing it when it gets hang up, you can use the ssh escape character:
That is, press the tilde and then the period, if it doesn't work, press Enter before you press that, that will kill the connection immediately.