ITTips
General tips
getent: then use passwd or ldap for checking the users in those files
During the startup of a 
CentOS, you can hit the i key to enter the interactive mode and choose which module to load.
pstree: to show the dependences of a process
sed -e "regexp" i.e.: sed -e s/blah/boup/g = sed -e s,blah,bloup,g     This is useful when you are scripting and using variables containing  path as you cannot do \/ in the variable ...
awk '{print $1}'
Using 
less  then press Shift+F will do the equivalent as 
tail -f with the advantages of 
less
When a process is in an interruptable sleep, you do not have any other choice than restarting the box to get rid of it.
Number of maximum open files: 
cat /proc/sys/fs/file-max
/etc/sysctl.conf : to tweak the kernel at startup
sysctl -A: displays the runtime kernel parameters.
Fosco Tips: 
grep -rH 'You are now configured to use the Fleet St HQ' /etc/
rsync and ssh on another port than port 22:
rsync -av --progress --inplace --rsh='ssh -p8023' somefile user@host:somedir/
Switch User
su - user -c '
command': this allows you to run a command while changing user.
SCREEN
CTRL+AC: creates a new screen in a screen session
CTRL+A
space key: Move to the screen on the right
CTRL+A
return key: Move to the screen on the left
CTRL+AA: move between the 2 last accessed screen
CTRL+A shift+A: Change the name of a screen window
When running screen sometimes there is a problem using the backspace or delete key and you get the dreaded “Wuff Wuff” message.
Edit: ~/.bashrc
And add: 
alias screen='TERM=screen screen'
Status line:
hardstatus alwayslastline
hardstatus string "%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %Y-%m-%d %{W}%c %{g}]"
hardstatus alwayslastline 
 hardstatus string "%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %Y-%m-%d %{W}%c %{g}]"
In case of a message like:
Must run suid root for multiuser support.
 
Do
First of all, in screen you have to hit C^a and then the colon (":") key to enter commands (much like vi). when you do that, you'll see a highlighted colon prompt at the bottom of the screen. Then turn on multiuser and grant permissions like Sanjay said.
Second, you may have to do some other things. I installed screen with the Debian package, and multiuser mode didn't work out of the box. You could add people to the acl list, but when you did:
screen -ls otheruser/
you'd get the error:
Must run suid root for multiuser support.
To make screen run as suid root, as the root user do:
 
chmod +s /usr/bin/screen
(or whatever the path to your screen executable is)
 
There is also a command called aclgrp, whereby you can assigna group of users similar access to screen. Note that this doesn't mean you can automatically give everyone in a particular Unix group access to a screen session, though. I might work on a little script to do that. If I figure it out, I'll post it here.
You have to  
 
chmod 755 /var/run/screen/
 
More information on this web page: 
http://www.softpanorama.org/Utilities/screen.shtml∞
chkconfig --list: will display which service are started in the different run levels
chkconfig servicename on/off: starts the servicename in appropriate runlevel
Check library dependency
ldd executable_file
 Reload .bash_profile
source .bash_profile
Change display color setting for a shell
dircolors
Startup message
/etc/motd
/etc/profile
VIM
This is a really nice bit of information: 
http://www.vim.org/tips/tip.php?tip_id=305∞
Doing some tricks on a all set of lines:
-  v to enter visual mode
-  Select your text
-  press colon : The following will appear: :'<,'>  this is your selected text
-  then enter your replace string: :'<,'> s/this/This/g
-  Press enter and you will be an happy bunny!
Syntax highlighting: 
:syntax enable
The 
g command explanation: 
http://www.vim.org/tips/tip.php?tip_id=227∞
useful command for stopping indentation when pasting: 
 set paste 
To get some help for ctrl+w for instance: 
 :h CTRL-W  
My .vimrc file: 
syntax on
set nu
set hlsearch
set incsearch
set autoindent
 
To search a pattern across an entire file, go onto the work and press the start "*" key.
LVM
Extend a partition:
 1.  lvextend -L+5G /dev/vg_data/Movies
 2. resize2fs /dev/vg_data/Movies
 Channel bonding
# cat /etc/modprobe.d/bonding.local
alias bond0 bonding
options bonding miimon=100 mode=balance-rr
http://smhteam.info/wiki/index.linux.php5?wiki=ChannelBonding∞
 SSL 
Generate a new private key: openssl genrsa -des3 -out domain.name.key 1024
Generate a CSR:  openssl req -new -key domain.name.key -out domain.name.csr
digicert is good
 tar 
 
tar -cvvf destination.tar source
 
 email redirection 
Update the file /etc/aliases and add the email address you want the email sent to as follow:
Then run the command:
 tcpdump 
tcpdump -pni any tcp port 3306
 
 time 
symlink /etc/localtime pointing to your time zone change it to link to GMT in /usr/share/zoneinfo
 
 
				
				
There are no comments on this page. [Add comment]