Updating perl modules from CPAN
Any modules available in CPAN could be easily updated to your system.eg: to update the module "Bundle::ApacheTest"
perl -MCPAN -e 'install Bundle::ApacheTest'
perl -MCPAN -e 'install Bundle::ApacheTest'
untar a tar.gz2 file
tar -xjvf php.5.1.2.tar.bz2
untar a tar.gz file
tar -zxvf php.5.1.2.tar.gz
login as super user:
sudo su
install a package in debian Linux:
apt-get install gcc
search a package:
apt-cache search <patern>
updagte all:
apt-get update
chmod with group name and permission name.
chmod o+w file_name: adding write permission for others
chmod g+w file_name: adding write permission for group
chmod u+w file_name: adding write permission for user/owner
installing the kernel headers:
apt-get install linux-headers-2.6.12-9-386
copying file to other machine
scp <file_name> <user_id>@<ip_address>:<user_home>/dir
Note: this need ssh get installed.
Installing a debian package
dpkg -i skype.deb
list selected columns by formatting the output with awk
eg: to List only the 1st and 3rd column of ls -al output...
ls -al | awk '{print $1 $3}'
scan disk with FAT32 file system
fsck.vfat /dev/sda5
format disk
mkfs.vfat /dev/sda5 format disk.
format the output of 'top' command..
-press f to go to interactive commands.
-press W to write the current settings to a config file.
now, top will output according to your last written settings.
writing the output of top command to a file..
top -b > top_output.stats
Option "EmulateWheel" # to get the trackpoint scrolling workin
Option "EmulateWheelButton" "2"
Eg:
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
Option "EmulateWheel" # to get the trackpoint scrolling working
Option "EmulateWheelButton" "2"
syntax: strace -p <process ID>
sris@sris:~$ strace -p 9860
Process 9860 attached - interrupt to quit
select(0, NULL, NULL, NULL, {0, 702000}) = 0 (Timeout)
waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
Process 9860 detached
strace -pt <process_id> will prefix the time of the day with each sys
call printed.
sris@sris:~$ strace -t -p 9860
Process 9860 attached - interrupt to quit
02:00:26 select(0, NULL, NULL, NULL, {0, 855000}) = 0 (Timeout)
02:00:26 waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
02:00:26 select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
02:00:27 waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
02:00:27 select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
Process 9860 detached
Find and replace in multiple files
----------------------------------------------------
perl -pi -i 's/search_string/replace_string/g' *.txt
2. cp /home/sris/downloads/vikatan.ttf .
sudo chown root.root *.ttf
sudo mkfontdir
3. cd ..
fc-cache
* Removing r permission
Can't do 'ls' but can do 'cd' and can copy files with absolute path
sris@sris:~$ chmod -r protected_dir/
sris@sris:~$ ls protected_dir/
ls: protected_dir/: Permission denied
sris@sris:~$ cd protected_dir/
sris@sris:~/protected_dir$ ls
ls: .: Permission denied
sris@sris:~/protected_dir$ cd ..
sris@sris:~$ touch protected_dir/test2.txt
sris@sris:~$ ls protected_dir/
ls: protected_dir/: Permission denied
2. mkdir prog_name.tmp
3. dpkg-deb --extract prog_name.deb.orig prog_name.tmp
4. dpkg-deb --control prog_name.deb.orig prog_name.tmp/DEBIAN
# Now use your favorite editor to edit the Depends line as required:
5. vi prog_name.tmp/DEBIAN/control
6. dpkg --build prog_name.tmp
7. mv prog_name.tmp.deb prog_name.deb
If the ftps server running on 8990,
sris@sris:~/tmp$ lftp
lftp :~> open ftps://localhost:8990
lftp localhost:~> user sris password123
lftp sris@localhost:~> ls
-rw-r--r-- 1 sris sris 58 Feb 12 14:14 ftp_error.log
-rw-r--r-- 1 sris sris 104 Feb 12 14:14 httpsd.last
drwxr-xr-x 2 sris sris 4096 Feb 8 22:00 pub
drwxr-xr-x 2 sris sris 4096 Feb 8 22:00 uploads
* gftp is another tool. have to configure and install with openssl
./configure --with-openssl
2. upload your id_rsa.pub file as ~/.ssh/authorized_keys to the remote host
eg: if u want to upload to a host called boo
scp ~/.ssh/id_rsa.pub boo:.ssh/authorized_keys
3. set your local and remote .ssh directory's permission to 700
4. set your remote authorized_keys file's permission to 600
5. set local id_rsa file's permission to 600
6. set local id_rsa.pub and known_hosts permission to 644
now you can just do 'ssh boo' without giving a login password. but if
you have given a passphrase it will ask for it.
you can save your passphrase by 'ssh-add' util.
7.
sris@sris:~/projects$ ssh-add
Enter passphrase for /home/sris/.ssh/id_rsa:
Identity added: /home/sris/.ssh/id_rsa (/home/sris/.ssh/id_rsa)
now you have the luxary to do
1. ssh boo
2. scp file.txt sris@boo:
without providing a passwd or passphrase.
8 If you add your key to the remote host's role account, you have to
concatenate your key with the existing ones.
cat id_rsa.pub >> authorized_keys
this will ensure other user's key will not be replaced by yours.
2. Install gcc and build tools
apt-get install build-essential
apt-get install manpages-dev autoconf automake libtool
apt-get install flex bison gcc-doc g++
3. apt-get install mozilla-thunderbird
4. apt-get install openssh-server
5. apt-get install libqt3-mt (used for skype)
2. Create the certificate
openssl req -new -x509 -nodes -days 365 -key host.key > host.cert
3. Create .pem file
Some applications require the private key and certificate in a single
.pem file. then..
cat host.cert host.key > host.pem