How do I set the date and time in Linux?
Setting Linux date. Go back 1 hour date –set=’-60 minutes’ Go forward 4 months date –set=’+4 months’ Go back 2 days date –set=’-2 days’
A little bit of wisdom
Setting Linux date. Go back 1 hour date –set=’-60 minutes’ Go forward 4 months date –set=’+4 months’ Go back 2 days date –set=’-2 days’
Removing ^M from Unix files with vi Description – UNIX treats the end of line differently than other operating systems. Sometimes when editing files in both Windows and UNIX environments, a CTRL-M character is visibly displayed at the end of each line as ^M in vi. Directions – To remove the ^M characters at the […]
This example shows how to create a custom xinetd service, in this case to forward radmin (port 4899) to another server using netcat. Create a file in /etc/sysconfig/xinetd.d/ (call it what you want – but for this example radmin would be a good choice) Create a definition in your /etc/services file contains a mapping for […]
Turn on IP forwarding in Linux IP. To turn forwarding on temporarily, use the following command as root: (this will be disabled after a reboot) echo “1” > /proc/sys/net/ipv4/ip_forward Or to make it permanent add the following to /etc/sysctl.conf net.ipv4.ip_forward = 1 In older versions of Redhat / CentOS you can edit /etc/sysconfig/network and enable […]
Label Linux partitions e2label device e2label /dev/sda1
Note: this article is quite dated now as there are easier ways to install spamassassin but if you want to install from source this will work. Installing Spamassassin Login as root and run a Perl shell (cpan I think) perl -MCPAN -e shell Then begin the installation: install Mail::SpamAssassin Install will commence and once complete, […]
Some distributions of Linux use a different default screen font, resulting in strange fonts when using MC in PuTTY. The following fixes this problem. Backup /etc/sysconfig/i18n – then clear the contents of the existing file and add the following lines: LANG=”en_GB.iso885915″ SUPPORTED=”en_GB.iso885915:en_GB:en:en_US.iso885915:en_US:en” SYSFONT=”lat0-sun16″ SYSFONTACM=”iso15″ Log out and back in again, and MC will now display […]
Change Unix file permissions recursively: To list: Note: use “iname” for a case insensitive operation find . -name “*.pls” -exec ls -ls {} \; To Change find . -name “*.pls” -exec chmod 750 {} \; (execute the chmod command for every file [named *.pls] found by find.) find . -type d -exec chmod 755 {} […]
Authenticated FTP with MC /#ftp:[!][user[:pass]@]machine[:port][remote-dir] cd /#user:pass@site
vi search and replace: (in command mode) The following strings illustrate how to perform a search and replace in the Unix vi editor. :g/old_text/s//new_text/g Replace EOL (end of line) :g/$/s//new_string/g where $ is EOL and \t = a tab The start of line can be equally easily searched and replaced – using the carat ^ […]