Skip to content

how to change date on linux

  • by

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

  • by

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 chkconfig –add service2

Change 404 Page on Apache – Linux

  • by

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. /etc/init.d/apache2 restart Done!  

Sendmail Masquerading

  • by

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 : dnl # Masquerading options FEATURE(`always_add_domain’)dnl MASQUERADE_AS(`example.domain.com‘)dnl FEATURE(`allmasquerade’)dnl FEATURE(`masquerade_envelope’)dnl All you have to do is to change MASQUERADE_AS(`example.domain.com‘)dnl to MASQUERADE_AS(`domain.com‘)dnl Restart sendmail service #/etc/init.d/sendmail restart Done!

Disable Suspend and Hibernate – Ubuntu

  • by

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

  • by

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 “con” or “linux” the string that invokes the specified capabilities on the PC Minix virtual console driver is output. Options that are not implemented by the terminal are ignored $ setterm -powersave off -blank 0 If it dumps back you with an error that read… Read More »Disable screen going blank ubuntu server / Network timeout

Sendmail Linux Examples

  • by

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 or use a script.    $ vim email.txt date: todays-date    // not required to: user-email@example.com subject: subject from: your-email@example.com Body of message goes here   Then call sendmail with that file as an input:     $ sendmail -t user-email@example.com < email.txt   Or you can… Read More »Sendmail Linux Examples

Delete / remove old / order files in linux automatically

  • by

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

  • by

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 (or another specified signal) to a specified set of processes. Task: Resume Halted User Called username Send CONT single to user username, type the following command: # skill -CONT -u username Task: Kill and Logout a User Called username You can send KILL single, type… Read More »Kill and Logout Users From linux