Search This Blog
Thursday, May 5, 2011
Useful Commands, a script to keep your ssh session alive
sh -c 'while echo "alive" > /dev/null; do sleep 20; done' &
Friday, April 22, 2011
Useful Commands, swapoff swapon
flush the swap:
turn on the swap:
swapon -a
Tuesday, March 29, 2011
Useful Commands, ntpdate
more ntp timer server can be found here:
http://support.ntp.org/bin/view/Servers/NTPPoolServers
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-ntp.html
Friday, February 18, 2011
Useful Commands, Mount FreeBSD ufs in Linux
You can mount them with:
sudo mount -r -t ufs -o ufstype=ufs2
for example:
sudo mount -r -t ufs -o ufstype=ufs2 /dev/sdb1 /mnt
Thursday, December 30, 2010
Useful Command, vidcontrol for Console Resolution
options VESA
options SC_PIXEL_MODE
and install your new kernel. After that you can check with vidcontrol -i mode, you can see several high resolution available. To use a 800x600, do:
vidcontrol VESA_800x600
check the manual page for vidcontrol, you might need to load different fonts for different screen resolutions.
reference:
http://www.freebsd.org/doc/en/books/handbook/consoles.html
http://forums.freebsd.org/showthread.php?t=9449
Wednesday, December 29, 2010
Useful Command, kbdcontrol
kbdcontrol -r fast
will make your key repeat rate fast.
or add
keyrate="fast"
to your /etc/rc.conf
Wednesday, December 22, 2010
FreeBSD, capture the terminal output
In the console, just type script /place/to/store/output/file.txt
you can continue your work on this console.
To end it, just type exit on the console.
Tuesday, December 8, 2009
Useful command, sendmail
mail.txt have the following format: (the -t option)
to:recipient@somewhere.comand log.txt can log everything in and out. (the -X option)
from:you@yourdomain.com
subject:Testing 123
This is my message.
Friday, October 2, 2009
Useful Command, pgrep and pkill
for example, to kill all the idle (I) vlc process,
pkill vlc
then if we use pgrep vlc, we can see that all vlc processes are removed.
Monday, September 21, 2009
Useful Commands, Soft Link
ln -s (target, your actual file) (symbolic link, referencing to the actual file)
say you are missing libz.so.5 in your system and your program requires it. A quick walkaround is to let libz.so.5 work as a symbolic link to another libz.so, e.g.
ln -s /lib/libz.so.6 /lib/libz.so.5
Soft Link
ln -s /directory/of/application/ /directory/and/softlink
e.g. ln -s /usr/local/apache-tomcat /usr/local/apache
This created an ‘apache’ softlink to apache-tomcat directory
ls -l
apache -> /usr/local/apache-tomcat
To use hard link, just remove the -s option
Wednesday, September 2, 2009
Useful Command, Check If SSHD Is Running
ps -A | grep sshd
It can also check if other servervices are running too, like ftpd, httpd, etc.
Sunday, August 2, 2009
Useful Commands, List Top Ten Largest Files
Print as human readable format.
Play with du(disk usage), sort, and head commands together.
Useful Commands, List The Partition Table with fdisk
Sometimes it is useful to run the above command on a dual boot system.
For example, under Linux we can see the information, and mount the Windows partition.
mount /dev/sda1 /media/c
Wednesday, July 22, 2009
Useful Commands, Split Files Using Winrar with Command Line
a, create an rar archive
myfile.rar, name of your newly created rar
myfile.iso, file(s) you would like to archive
-v, how would you want to split
500m, 500MB split
Useful Commands, Update Software in Ubuntu
sudo apt-get update (refresh the latest packages from your /etc/apt/sources.list)
sudo apt-get upgrade (update the latest package(s))
sudo apt-get install your_software (install the individual package)
sudo aptitude search your_software (search the package)
Tuesday, July 7, 2009
Useful Commands, Truss to Trace System Calls
To learn more about system call, we can use truss to trace system call on a process.
Sunday, July 5, 2009
Useful Commands. Mount USB key in FreeBSD7
Mount USB key in FreeBSD7
/etc/rc.conf (load modules at boot time) (or recompile the kernel) usb_load="YES" umass_load="YES"$
insert flash key, da0 should show up on the console when typing dmesg
mount_msdosfs /dev/da0 /mnt (make sure the directory /mnt is there already)
(take a look at /dev, and make sure the mount directory is there)
Monday, June 8, 2009
Useful Commands
'/' to search, 'n' to search the next
'v' to bring up the editor
'g' + line , go to line
Emacs:
M-g g: go to line
+: mkdir (in Dired mode)
R: rename file (in Dired mode)
C: copy file (in Dired mode)
e: edit file (in Dired mode)
d then x to confirm, u to unmark: delete file (in Dired mode)
Reference: http://www.astro.ku.dk/comp-phys/tutorials/emacs.shtml
Vi:
(up)
k
(left) h l (right)
j
(down)
x is to delete
i: insert, (use Esc to escape)
':', type command, w is to write
Subversion:
Diff with previous version:
svn diff -r #(revision number) | more
See historical change of each line:
svn blame /usr/src/sys/net/if_gif.c | more
mixer:
change volumn