Open your terminal gnome-terminal Type date for show the current date and time date Tue Apr 12 Mon Mar 16:00:00 GMT 2011 To change the date type some think like below date 041218002013 In details is sudo date 04 (Month) 12 (Day) 1800 (Time in 24hour) 2013 (Year)
How to add a service on Linux using chkconfig
Add a service to auto start in linux Add the below #comment lines on top of the script which always located /etc/init.d/ #chkconfig: 2345 20 80 #description: Saves and restores system 2,3,4,5 are starting levels 20 startup priority 80 stop priority causes the line to be continued Finally add services to “autostart” chkconfig –add service1 […]
Change 404 Page on Apache – Linux
Use the ErrorDocument directive in your conf file to set a custom error message. The easiest way to do this: Create a file with your custom error message. Save it in: vim /var/www/not_found.html Edit vim /etc/apache2/httpd.conf : Find the line that says: #ErrorDocument 404 /not_found.html Remove the leading “#”. ErrorDocument 404 /not_found.html Save. Restart apache. […]
Sendmail Masquerading
After install sendmail .. follow the below procedure to simply avoid your emails to get spammed. Also avoid email address to shown as root@example.domain.com with masquerading. This feature allows multiple hosts to send mail from the same domain name. Configure sendmail.mc file. # vim/etc/mail/sendmail.mc and at the bottom of the file you will find : […]
Disable Suspend and Hibernate – Ubuntu
Open a Terminal from Applications>Accessories>Terminal. Become a root with su – or sudo su – vim /usr/share/polkit-1/actions/org.debian.aptxapianindex.policy Find the lines: <allow_active>yes</allow_active> Change this entry from “yes” to “no” to disable hibernate/suspend. <allow_active>no</allow_active>
Disable screen going blank ubuntu server / Network timeout
Using setterm command. man setterm : writes to standard output a character string that will invoke the specified terminal capabilities. Where possible terminfo is conâ sulted to find the string to use. Some options however (marked “virtual consoles only” below) do not correspond to a terminfo(5) capability. In this case, if the terminal type is […]
Sendmail Linux Examples
Sendmail on the command line: $ sendmail emailaddress write body of message CTRL-D The CTRL-D is a end of message code for standard-in. Example : From: your-email@example.com To: email@example.com enter body of message This message is missing a useful TO:line as well as a subject. To create these you need to create a file […]
Create tar and copy to another server using tar
Just a note Code: tar -cvf – test | ssh -l username domain.com “cd /home1/username && tar -xvf -“
Delete / remove old / order files in linux automatically
Code: find /tmp/test -ctime +60 -delete The above command will delete any files created over 60 days ago in the /tmp/test folder (and all subfolders). You can add this to a cron job and it will be automatic daily, weekly, monthly
Kill and Logout Users From linux
Open a terminal, and then type the following commands. Login as root su – or sudo su – and entering the root password. Type the skill command as below: # w to show who is log in to your system and then : # skill -STOP -u username The skill command sends a terminate command […]