|
Today Quick Tip: Change FreeBSD Shell |
|
|
|
If you want to change default shell for a user use:
chsh -s /usr/local/bin/bash adrian
Where: adrian is the username and /usr/local/bin/bash is the new shell binary.
If you want to change that and other account variables use:
chpass adrian |
|
|
Choose from what drive to load FreeBSD at boot |
|
|
|
You can choose from what drive to boot FreeBSD at boot time by escaping to boot load prompt and typing:
boot disk2s1a:/boot/kernel
This will boot FreeBSD from your second hard drive (first drive is disk1). |
|
|
Today Quick Tip: Use epdfview to read PDF documents |
|
|
|
If you do not want to install Linux binary compatibility package/port to use Acrobat Reader of you have issues with it (for example Acrobat Reader crashes or will not scroll up/down when you keep arrow key pressed) and if you don't like the simplicity of xpdf then there is another application useful for viewing/reading of PDF documents: epdfview.
whereis epdfview cd /usr/ports/graphics/epdfview make install clean rehash
You can also add this app in mc extension menu so when you press Enter on an document in Midnight Commander it will open that document with epdfview. |
|
|
Today Quick Tip: Nice MySQL Client Cursor |
|
|
|
|
To have a nice cursor when you use your console/shell mysql client add at section [mysql] in your my.cnf file the following: [mysql] no-auto-rehash prompt=(\\u@\\h) [\\d]>\\_
If you do not have any my.cnf mysql config file in /etc copy one from: /usr/local/share/mysql/ to /etc and rename it to my.cnf.
|
|
|
Resetting flags for a file or directory with chflags |
|
|
|
Sometimes you are not able to delete a file or a directory even if you are the owner of that file. Or simetimes as root you are not able to delete a file or dir. Show what to do?
Use chflags to remove all flags that were set to that file:
chflags 0 filename
For example you cannot delete /var/empty file:
chflag 0 /var/empty |
|
|
Today Quick Tip: Show Process IO Load |
|
|
|
|
To see processes that consume lot of I/O use top command: top -mio
|
|
|
Today Quick Tip: Add a user to a group |
|
|
|
|
If you have the user john and you want to add that user to group managers, in FreeBSD use pw command:
pw groupmod managers -M managers,john
This is how to add a user to a group in FreeBSD. |
|
|
Today Quick Tip: Redirect stdout and stderr to the same file |
|
|
|
For example if you want to write a script and all your error and other messages to be redirected to a file you can use in every command at the end of the command the following: >/tmp/install.log 2>&1
For example if in a script you clone a hard drive you can use this:
dd if=/dev/ad0 of=/dev/ad1 bs=8M >>/tmp/install.log 2>&1
This will log your output of the dd command to install.log. |
|
|
Remove a TCP connection for a zombie process |
|
|
|
If you've stopped a service on a port but you still see the connection you can remove it with tcpdrop.
For example if you do not have any process running on 8080 but doing:
netstat -n | grep 8080 tcp4 0 0 10.0.0.104.8080 10.0.0.20.1217 LAST_ACK
you can close that connection with:
tcpdrop 10.0.0.104 8080 10.0.0.20 1217
Note1: The syntax is: usage: tcpdrop local-address local-port foreign-address foreign-port
Note2: After a while the operating system will close that connection that belongs to a zombie process.
Note3: You can also use it to close connection for legitime/working processes, if a connection eats to many resources on the server. |
|
|
Today Quick Tip: Find package name without compiling |
|
|
|
|
To find port/package full name (name and version) from ports use: make package-name
To build package from ports
make package
To build package and needed packages for a port:
make package-recursive
|
|
|
Today Quick Tip: Find dependencies for a port without compiling |
|
|
|
Here are some usefull commands to find dependencies for a port without compiling that port:
make build-depends-list
make run-depends-list
make missing |
|
|
|