Linux Commands and Tips

[Change HOSTNAME]

~$ sudo -i
~$ hostname newhostname

[Shell]

~$ cat /etc/lsb-release
~$ lsb_release -a
~$ uname -a (print all info)
~$ uname -r (print kernel release)
~$ uname -v (print kernel version)
~$ uname -o (print operating system)
~$ cat /etc/issue

[dd command to write an ISO image to USB drive]

To list available USB drives

BSD# sudo fdisk -l
MAC# diskutil list

BSD# umount /dev/da0
Linux# umount /dev/sdb
MAC# diskutil unmountDisk /dev/disk1

# bunzip2 -k PCBSD9.2-RELEASE-x64-USBFULL.img.bz2
# tar xjf filename.bz2

To list available USB drives

BSD# dd if=PCBSD9.2-RELEASE-x64-USBFULL.img of=/dev/da0 bs=64k conv=sync
Linux# dd if=PCBSD9.2-RELEASE-x64-USBFULL.img of=/dev/sdb bs=64k conv=sync
MAC# sudo dd if=/Users/dru/Downloads/PCBSD9.2-RELEASE-x64-USBFULL.img of=/dev/rdisk1 bs=4m
(/dev/da0 and /dev/sdb is the target USB drive; on Linux don’t put number after /sdb)

The output result will look like this:

sudo dd if=~/Desktop/linuxmint.iso of=/dev/sdb oflag=direct bs=1048576
706+1 records in
706+1 records out
740601856 bytes (741 MB) copied, 91.7024 s, 8.1 MB/s

[Start Serial Communication in BSD Terminal]

Open Terminal To get a list of all serial ports type:

ls /dev/tty.*
You will see results similar to
/dev/ttyu0
/dev/tty.Bluetooth-Modem
/dev/tty.KeySerial1

/dev/ttyu0 is my physical serial port
/dev/tty.Keyserial1 is my Keyspan USB-to-serial adaptor

Knowing the serial port, you can type “screen portname datarate” to start a serial connection.
Example: screen /dev/ttyu0 9600

[Firefox config – bypass the print dialog box in Firefox]

Open firefox and type ‘about:config’ in the address bar and press Enter

If that entry is missing create one: