BSD Stuff
Funky Commands
14 September 2006, 02:06
Here I’ll make a list of all the funky commands that I use and discover. They may be from the very obvious commands to a few lines that I only used once.
This is to move directories with the permissions intact. Lets say I want to move the directories /var/ or /usr/local/ it is very important to keep the permissions. To do that I use tar.
# tar -cf - -C srcdir . | tar -xpBf - -C destdir
Lets say I want to move this directory to another server. Again we use tar but this time we pipe it trough ssh. You also have to be able login as the root user on the destination server or you will loose the permissions.
# tar -cvf - -C srcdir . | ssh root@host tar -xpBf - -C destdir
This will show you the memory usage
# systat -vmstat 1
This is to see the messages after a package or port has been installed
# pkg_info -Dx <Package/PortName>
This will show the apache modules that are installed
# make show-modules
This will update the locate database
# /usr/libexec/locate.updatedb
This will show the directory sizes
# du -hs *
This will return the working directory name
# pwd
To read the documentation in /usr/share/doc/
> gzcat /usr/share/doc/whatever-doc/* | more
To see which ports are open
> netstat -a | grep LISTEN
or
> netstat -anp tcp
To manually update the time from the command line
> ntpdate us.pool.ntp.org
Page 1 of 1