Dig command to see the traces deep on DNS Configuration
dig qa.services.getcamber.com +trace List open ports and listening services
Command in Linux to list ports
netstat -lnptu
Command in Windows to list ports
netstat -a | find "LISTENING"
Expression to run cronjob on every sunday 2nd and 4th week at 8 PM EST : 0 20 * * 0#2,4 minute (0-59), hour (0-23), day of the month (1-31), month of the year (1-12), day of the week (0-6 with 0=Sunday)
Copy files from directory, copy file with parent directory structure
find . -name 'config.xml' -exec cp --parents \{\} ./jenkins-config-backup \;
Ex: jenkins-config-backup is the folder (destination) we copy the file
Ubuntu sudo unable to resolve host
3) sudo vi /etc/postfix/main.cf (Paste below configuration). Replace myhostname, you can provide relayhost or leave blank
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = glakshmanan-laptop
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = glakshmanan-laptop, localhost.operative.com, localhost
#relayhost = mail.operative.com
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
4) sudo /etc/init.d/postfix restart (Once the configuration is done we need to restart postfix)
5) tail -f /var/log/maillog
Installing software on Ubuntu usually entails using Synaptic or by using an apt-get command from the terminal. Unfortunately, there are still a number of packages out there that are only distributed in RPM format.
There’s a utility called Alien that converts packages from one format to the other. This doesn’t always mean that an rpm will work on your system, though. You will need to install some prerequisite software packages in order to install alien, however. These packages include gcc and make.
Run this command to install alien and other necessary packages:
Connect to remote host without giving passphrase from host (X). Follow steps and you should be good
Run command in your host (X) : ssh-keygen -t rsa
Copy the created .pub file into remote host (Y).
connect to remote host
cat .pub_file >> ~/.ssh/authorized_keys
for k in $TENANTS
do
echo curl -L -d"j_username=supportops@$k.com&j_password=Oper@t1ve&j_inp_password=Oper@t1ve" http://$host:8080/$webapp/api/migrateFinanceInvoices/
ls -LR - List all the files from the recursive directory find -focus - This command also list all the files in recursive directory
du -sh - Disk usage size for the folder (s - size, h - human readable format) Or du -ch | grep total dmesg - If the program dies with out of memory or died you can search in dmesg. (dmesg | grep "Killed process") cat /var/log/kern.log | grep "Killed process"
sudoers: (http://www.mjmwired.net/resources/mjm-fedora-f14.html)
sudoers - list of which users may execute what they want. Certain things if you want to execute you need to have a root permission or switch user to root.
When you try `sudo su` and if it fails than your name is not in sudoers list. In fedora you need to explicitly add the username in sudoers list. Login as root and execute below command to add user.
Execute : echo ' ALL=(ALL) ALL' >> /etc/sudoers If the file doesn't have write permission execute `chown +w /etc/sudoers` How to add url into Fedora Repository ? Its like sources.list in Ubuntu vi /etc/yum.repos.d/fedora.repo
How to Redirect the stderr to a file using tee ?
Syntax : ./shell_script_name.sh 2>&1 | tee -a error.log
mysql -uroot -ppetra123 test < upgrade_pre_phase.sql > error.out 2>&1
nohup - run a command immune to hangups, with output to a non-tty
Add nohup before you run the shell script or command. nohup will create nohup.out in the same script running directory and write the stdout / stderr into the file.
Ex : nohup ./shell_script_name.sh &
& - If you add amp this command will run in the back-ground
Find Folder Size greater than 200 MB find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Finding Disk usage
Top 100 disk usage : du -ka / | sort -n | tail -100
fdisk - partition table manipulator for Linux
fdisk -l - This will list the partition available to mount How to mount space into system from fdisk
Syntax : mount disk folder
ex: mount /dev/sda2(disk) /hadoop(folder) Add export classpath variable in /etc/profile
ex : rsync -avz --exclude *.csv root@targethostname:{$directory}${PWD}
a => Archive
v = > Verbose
z => compress
exclude => will exclude the mentioned files
Alternatives - Point your java to point to different directory from default openJdk
Grep the text recursively against all the filesystem
grep -r "text" /
Make your Terminal display shorter (Your Terminal prompt show small)
export PS1='$' $
Provide the Input command in next line in linux
$ hadoop jar example.jar \
$ > wordCount
(Put backslash and enter will prompt with > in next line to proceed)
Stop / Disable the firewall Type the following two commands (you must login as the root user): # /etc/init.d/iptables save # /etc/init.d/iptables stop
Shell script to read a file line by line #!/bin/bash file="${DIRECTORY}/$fileName.csv" while IFS= read -r line do # display $line or do somthing with $line echo $line done <"$file" Date : 2 day ago : /bin/date --date="2 day ago" +%Y-%m-%d 1 day ago from the given date : /bin/date --date="2013-04-20 1 day ago" +%Y-%m-%d
No comments :
Post a Comment