Notes by voodoo
Displaying notes 31 - 40
Created by voodoo on June 21, 2011 08:32:15
Last update: June 21, 2011 08:32:15
The Dos2unix package includes utilities "dos2unix" and "unix2dos" to convert plain text files in DOS or MAC format to UNIX format and vice versa.
By default, it replaces the original file:
$ dos2unix base64_encoded.txt
dos2unix: conver...
Use the -n switch to write the converted output to a new file:
$ dos2unix -n base64_encoded.txt unix_formatted.tx...
Using STDOUT ( - ) as output file does not work :
$ dos2unix -n base64_encoded.txt -
Use input redirection to write to STDOUT:
$ dos2unix < base64_encoded.txt
Created by voodoo on June 16, 2011 11:34:39
Last update: June 16, 2011 11:34:59
Some ways to refresh DHCP on Linux:
To release IP address lease:
$ sudo dhclient -r
then, to get fresh IP:
$ sudo dhclient
Use ifdown and ifup :
$ sudo ifdown eth0
$ sudo ifup eth0
Restart network:
$ sudo /etc/init.d/network restart
or,
$ sudo /etc/init.d/networking restart
Created by voodoo on June 14, 2011 15:16:30
Last update: June 14, 2011 15:18:18
Count the total number of lines of shell scripts (files ending with sh ):
$ find . -type f -name \*.sh | xargs wc -l
2...
Count the total number of lines for files under the src directory:
find src -type f | xargs wc -l
Count the total number of lines for files under the current directory whose path contains src/ :
find . -type f -path \*src/\* | xargs wc -l
Created by voodoo on June 14, 2011 13:21:09
Last update: June 14, 2011 13:21:09
config.version = "8"
virtualHW.version = "3"
...
Created by voodoo on June 14, 2011 08:53:01
Last update: June 14, 2011 08:53:01
To save (saving to /etc/iptables.rules ):
iptables-save -c > /etc/iptables.rules
To restore:
iptables-restore < /etc/iptables.rules
iptables-save and iptables-restore are just symbolic links to iptables-multi . Create the links if they don't exist.
Reference: IptablesHowTo
Created by voodoo on June 14, 2011 08:15:57
Last update: June 14, 2011 08:17:25
In below examples, the default gateway is 105.52.84.1 .
Use " netstat -rn ":
$ netstat -rn
Kernel IP routing table
Destin...
Use " route -n ":
$ route -n
Kernel IP routing table
Destinati...
Use " ip route show ":
$ ip route show
105.52.84.0/24 dev eth0 proto ...
Created by voodoo on June 14, 2011 08:10:42
Last update: June 14, 2011 08:10:42
The command " ifconfig -a " does not list the DNS servers. Use " cat /etc/resolv.conf " to look at the DNS server configuration. It works for DHCP configured network interfaces also.
$ cat /etc/resolv.conf
# Generated by NetworkMa...
If no DNS server is configured:
$ cat /etc/resolv.conf
# Generated by NetworkMa...
Created by voodoo on June 12, 2011 20:41:35
Last update: June 12, 2011 20:41:35
Tried to test IPFire under VMWare: IPFire installation failed. After I hit enter at the first screen, the next screen came up blank! I thought it was a compatibility problem between VMWare and Ubuntu 11.04, but it turned out that I didn't give enough memory allocation to the VM. I allocated 64MB RAM but it looks like IPFire needs at least 256MB.
Created by voodoo on June 12, 2011 19:59:59
Last update: June 12, 2011 20:00:38
Three ways to find the Ubuntu version:
$ cat /etc/issue
Ubuntu 11.04 \n \l
$ lsb_release -a
No LSB modules are available.
...
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DIS...
Created by voodoo on June 06, 2011 12:31:54
Last update: June 06, 2011 12:32:27
$ yum list installed >/tmp/installed-packages