<<O>>  Difference Topic UnixStuff (r1.22 - 12 Dec 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 160 to 160

Filenames can have spaces in them!

Added:
>
>

XEmacs

To get rid of that annoying flashing when making a mistake in XEmacs:

M-x

set-variable

visible-bell

Value: nil


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.21 - 11 Dec 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 116 to 116

procps-2.0.7-11.21AS.4

Added:
>
>
To list the files in an uninstalled package:

rpm -qpl packagename.rpm 


Vim

 <<O>>  Difference Topic UnixStuff (r1.20 - 03 Dec 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 150 to 150

Renaming a large number of hidden files

Changed:
<
<
The following command searches the current directory, recursively, for all hidden mp3 files, renaming them with a .blah suffix:
>
>
The following command searches the current directory, recursively, for all hidden mp3 files, appending a .blah suffix:

find . | egrep "/\..*mp3$" | while read e ; do mv "$e" "$e.blah"; done

 <<O>>  Difference Topic UnixStuff (r1.19 - 02 Dec 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 146 to 146

Note: your device might be mounted somewhere other than /dev/sda.

Added:
>
>

Renaming a large number of hidden files

The following command searches the current directory, recursively, for all hidden mp3 files, renaming them with a .blah suffix:

find . | egrep "/\..*mp3$" | while read e ; do mv "$e" "$e.blah"; done

Filenames can have spaces in them!


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.18 - 22 Nov 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 136 to 136

du -h  --max-depth=1

Added:
>
>

Prolong the life of your external USB drive

I have an external usb powered hard drive (one of these) connected to my server permanently, as part of my backup solution. To prolong the life of the disk, I spin it down after my overnight using the following command:

sdparm --command=stop /dev/sda

Note: your device might be mounted somewhere other than /dev/sda.


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.17 - 18 Oct 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 128 to 128

:set ff?

Added:
>
>

du

Lists the size of each directory/file in the current directory, and prints the sizes in human readable form:

du -h  --max-depth=1


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.16 - 21 Feb 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html


Generate random numbers on linux:
Changed:
<
<
dd if=/dev/urandom bs=1 count=128 | od -x
>
>
dd if=/dev/urandom bs=1 count=128 | od -x


Solaris:

Changed:
<
<
psrinfo -v lists the processors on a box
>
>

psrinfo -v

lists the processors on a box



Line: 121 to 124

:set ff=unix

Changed:
<
<
To find out what format a files is:
>
>
To find out what format a file is:

:set ff?

 <<O>>  Difference Topic UnixStuff (r1.15 - 23 Jan 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 113 to 113

procps-2.0.7-11.21AS.4

Added:
>
>

Vim

Setting a text file to unix format from DOS using vim:

:set ff=unix

To find out what format a files is:

:set ff?


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.14 - 18 Jan 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 101 to 101

Mon Jan  2 09:24:03 2006

Added:
>
>

RPM

To check the version of an installed rpm package, use the following command (this example looks at procps, which includes the ps command):

rpm -qa | grep procps

returns:

procps-2.0.7-11.21AS.4


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.13 - 02 Jan 2006 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 89 to 89

Note, no need to use xhost +. The above solution is much more secure, both for client and server. All communication is authenticated and encrypted. And you don't have to set/export your display on the client (debian)!

Added:
>
>

awk

To print a timestamp (UTC) in a locale readable string do the following:

echo "1136211843" | awk '{print strftime("%c", $1)}'

prints:

Mon Jan  2 09:24:03 2006


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.12 - 13 Nov 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 19 to 19

My backup drive, a Western Digital usb hard drive, had a vfat file system - which I found didn't preserve file permissions.

Changed:
<
<
The following describes how to convert from vfat to an ext3 file system. Remember, if you follow these instructions all your existing data will be erased. Be sure, be very sure you want to re-format your existing drive.
>
>
The following describes how to convert from vfat to an ext3 file system. Remember, if you follow these instructions all your existing data will be erased. Be sure, be very sure you want to re-format your existing drive.

Here goes...

Changed:
<
<
When you plug the drive in check dmesg to find out which /dev device it's been mapped to. I found mine under /dev/sda1.
>
>
When you plug the drive in check dmesg to find out which /dev device it's been mapped to. I found mine under /dev/sda1.

Then you'll need to partition the disk:

Changed:
<
<
fdisk /dev/sda1
>
>
fdisk /dev/sda1

Changed:
<
<
This will give you a command prompt interface. Type p to get a list of the current partitions.
>
>
This will give you a command prompt interface. Type p to get a list of the current partitions.

Changed:
<
<
I had 4 partitions, so I deleted them all using the d command.
>
>
I had 4 partitions, so I deleted them all using the d command.

Changed:
<
<
Then create your partition(s). I created one great big extended partition using the n command. It asks you a few questions about block sizes etc, I chose the defaults.
>
>
Then create your partition(s). I created one great big extended partition using the n command. It asks you a few questions about block sizes etc, I chose the defaults.

Changed:
<
<
Then I typed w to write the partition data to the disk. Then I quit fdisk.
>
>
Then I typed w to write the partition data to the disk. Then I quit fdisk.

Then I created the filesystem:

Changed:
<
<
mkfs.ext3 /dev/sda1
>
>
mkfs.ext3 /dev/sda1

It asked me a few questions, I excepted all the defaults.

Then you're ready to mount the device:

Changed:
<
<
mount /dev/sda1 /mnt/usbdrive
>
>
mount /dev/sda1 /mnt/usbdrive

You'll have to create the folder /mnt/usbdrive yourself.

So that the disk gets mounted on reboot add the following line to /etc/fstab:

Changed:
<
<
/dev/sda1 /mnt/usbdrive ext3 defaults 0 0
>
>
/dev/sda1 /mnt/usbdrive ext3 defaults 0 0

This also means you can simply type:

Changed:
<
<
mount /dev/sda1
>
>
mount /dev/sda1

when mounting the disk from the command line.

Line: 85 to 85

How to run x windows apps using X11 forwarding.

  • Enable X11 forwarding on the client (in my case a debian distro). To do this reconfigure the sshd daemon, by changing the line X11Forwarding no in /etc/sshd_config to X11Forwarding yes. Then restart the sshd daemon: /etc/init.d/ssh restart.
Changed:
<
<
  • From the server (in my case a Powerbook) login into the linux box (but make sure you this from an xterm session), using ssh (don't forget the -X): ssh -X linuxhostname. From the client (debian ssh prompt) run an app: xcalc, ddd etc. The window should appear on the server (Powerbook).
>
>
  • From the server (in my case a Powerbook) login into the linux box (but make sure you do this from an xterm session), using ssh (don't forget the -X): ssh -X linuxhostname. From the client (debian ssh prompt) run an app: xcalc, ddd etc. The window should appear on the server (Powerbook).

Note, no need to use xhost +. The above solution is much more secure, both for client and server. All communication is authenticated and encrypted. And you don't have to set/export your display on the client (debian)!

 <<O>>  Difference Topic UnixStuff (r1.11 - 04 Nov 2005 - JanetBall)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 85 to 85

How to run x windows apps using X11 forwarding.

  • Enable X11 forwarding on the client (in my case a debian distro). To do this reconfigure the sshd daemon, by changing the line X11Forwarding no in /etc/sshd_config to X11Forwarding yes. Then restart the sshd daemon: /etc/init.d/ssh restart.
Changed:
<
<
  • From the server (in my case a Powerbook) login into the linux box, using ssh (don't forget the -X): ssh -X linuxhostname. From the client (debian ssh prompt) run an app: xcalc, ddd etc. The window should appear on the server (Powerbook).
>
>
  • From the server (in my case a Powerbook) login into the linux box (but make sure you this from an xterm session), using ssh (don't forget the -X): ssh -X linuxhostname. From the client (debian ssh prompt) run an app: xcalc, ddd etc. The window should appear on the server (Powerbook).

Changed:
<
<
Note, no need to use xhost +. The above solution is much more secure, both for client and server. All communication is authenticated and encrypted. And you don't have to set/export your display on the client!
>
>
Note, no need to use xhost +. The above solution is much more secure, both for client and server. All communication is authenticated and encrypted. And you don't have to set/export your display on the client (debian)!

META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.10 - 02 Nov 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 82 to 82

X11

Changed:
<
<
I'm going to explain how I run x windows applications on my linux box (x client), displayed on my powerbook (x server), via X11 forwarding.
>
>
How to run x windows apps using X11 forwarding.

Changed:
<
<
  • I enabled X11 forwarding on the client (linux box, which btw is a debian install). To do this I reconfigured the sshd daemon, by changing the line X11Forwarding no in /etc/sshd_config to X11Forwarding yes. Then I restarted the sshd daemon: /etc/init.d/ssh restart.
  • From the Powerbook I'm now able to login into the linux box, using -X to ssh: ssh -X linuxhostname. From linux I run the app of my choice, xcalc, ddd etc. The window pops up on my Powerbook.
>
>
  • Enable X11 forwarding on the client (in my case a debian distro). To do this reconfigure the sshd daemon, by changing the line X11Forwarding no in /etc/sshd_config to X11Forwarding yes. Then restart the sshd daemon: /etc/init.d/ssh restart.
  • From the server (in my case a Powerbook) login into the linux box, using ssh (don't forget the -X): ssh -X linuxhostname. From the client (debian ssh prompt) run an app: xcalc, ddd etc. The window should appear on the server (Powerbook).

Changed:
<
<
Note, no need to use xhost +. The above solution is much more secure, both for client and server. All communication is authenticated and encrypted.
>
>
Note, no need to use xhost +. The above solution is much more secure, both for client and server. All communication is authenticated and encrypted. And you don't have to set/export your display on the client!

META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.9 - 02 Nov 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 78 to 78

According to testdisk my partition was situated at the 63rd cylinder -> 63 * 512 (assuming 512 bytes per block) = 32256 bytes.

Added:
>
>

X11

I'm going to explain how I run x windows applications on my linux box (x client), displayed on my powerbook (x server), via X11 forwarding.

  • I enabled X11 forwarding on the client (linux box, which btw is a debian install). To do this I reconfigured the sshd daemon, by changing the line X11Forwarding no in /etc/sshd_config to X11Forwarding yes. Then I restarted the sshd daemon: /etc/init.d/ssh restart.
  • From the Powerbook I'm now able to login into the linux box, using -X to ssh: ssh -X linuxhostname. From linux I run the app of my choice, xcalc, ddd etc. The window pops up on my Powerbook.

Note, no need to use xhost +. The above solution is much more secure, both for client and server. All communication is authenticated and encrypted.


META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.8 - 10 Oct 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 78 to 78

According to testdisk my partition was situated at the 63rd cylinder -> 63 * 512 (assuming 512 bytes per block) = 32256 bytes.

Added:
>
>
META FILEATTACHMENT dev.zip attr="h" comment="" date="1128942354" path="dev.zip" size="9513129" user="ChrisJones" version="1.1"
 <<O>>  Difference Topic UnixStuff (r1.7 - 31 Jul 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 19 to 19

My backup drive, a Western Digital usb hard drive, had a vfat file system - which I found didn't preserve file permissions.

Changed:
<
<
The following describes how to convert from vfat to an ext3 file system. Remember, if you follow these instructions all your existing data will be erased. Be sure, be very sure, you want to re-format your existing drive.
>
>
The following describes how to convert from vfat to an ext3 file system. Remember, if you follow these instructions all your existing data will be erased. Be sure, be very sure you want to re-format your existing drive.

Here goes...

Line: 59 to 59

when mounting the disk from the command line.

Changed:
<
<
This link is useful.
>
>
This link was useful.


Recovering a screwed NTFS disk

I created an image file from the corrupt disk using dd -> dd if=/dev/hdd of=imagename.img conv=noerror

I wanted to use an image file so that I could mess around without harming the data on the original corrupt disk.

I used testdisk to restore the image file's partition information (follow interactive menu system).

I was then able to mount the disk:

mount -t ntfs imagename.img /mnt/restoredntfs -o loop,offset=32256

Becasue I was mounting from an image file, I had to mount to a loop device. Thanks NASA, apparently.

According to testdisk my partition was situated at the 63rd cylinder -> 63 * 512 (assuming 512 bytes per block) = 32256 bytes.


 <<O>>  Difference Topic UnixStuff (r1.6 - 12 Jul 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 19 to 19

My backup drive, a Western Digital usb hard drive, had a vfat file system - which I found didn't preserve file permissions.

Changed:
<
<
The following describes how to convert from vfat to an ext3 file system. Remember, if you follow these instructions all your existing data will be erased. Be sure, be very sure, you want to re-format your existing drive.
>
>
The following describes how to convert from vfat to an ext3 file system. Remember, if you follow these instructions all your existing data will be erased. Be sure, be very sure, you want to re-format your existing drive.

Here goes...

 <<O>>  Difference Topic UnixStuff (r1.5 - 12 Jul 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 13 to 13


Changed:
<
<
Re-format external USB hard-drive
>
>
Re-format external USB hard drive (Debian)

Motive: I wanted a backup solution that preserved file permissions when using rsync with the -a option.

Changed:
<
<
My Western Digital usb drive had a vfat file system - which doesn't preserve file permissions.
>
>
My backup drive, a Western Digital usb hard drive, had a vfat file system - which I found didn't preserve file permissions.

Changed:
<
<
This is what you'll need to do in order to convert to an ext3 file system:
>
>
The following describes how to convert from vfat to an ext3 file system. Remember, if you follow these instructions all your existing data will be erased. Be sure, be very sure, you want to re-format your existing drive.

Here goes...


When you plug the drive in check dmesg to find out which /dev device it's been mapped to. I found mine under /dev/sda1.

Line: 31 to 33

I had 4 partitions, so I deleted them all using the d command.

Changed:
<
<
Then create a your partition(s). I created 1 great big extended partition using the n command. It asks you a few questions about block sizes etc, I chose the defaults.
>
>
Then create your partition(s). I created one great big extended partition using the n command. It asks you a few questions about block sizes etc, I chose the defaults.

Then I typed w to write the partition data to the disk. Then I quit fdisk.

Line: 53 to 55

This also means you can simply type:

Changed:
<
<
mount /dev/sda1
>
>
mount /dev/sda1

when mounting the disk from the command line.

Added:
>
>
This link is useful.
 <<O>>  Difference Topic UnixStuff (r1.4 - 12 Jul 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 11 to 11

Solaris: psrinfo -v lists the processors on a box
Added:
>
>

Re-format external USB hard-drive

Motive: I wanted a backup solution that preserved file permissions when using rsync with the -a option.

My Western Digital usb drive had a vfat file system - which doesn't preserve file permissions.

This is what you'll need to do in order to convert to an ext3 file system:

When you plug the drive in check dmesg to find out which /dev device it's been mapped to. I found mine under /dev/sda1.

Then you'll need to partition the disk:

fdisk /dev/sda1

This will give you a command prompt interface. Type p to get a list of the current partitions.

I had 4 partitions, so I deleted them all using the d command.

Then create a your partition(s). I created 1 great big extended partition using the n command. It asks you a few questions about block sizes etc, I chose the defaults.

Then I typed w to write the partition data to the disk. Then I quit fdisk.

Then I created the filesystem:

mkfs.ext3 /dev/sda1

It asked me a few questions, I excepted all the defaults.

Then you're ready to mount the device:

mount /dev/sda1 /mnt/usbdrive

You'll have to create the folder /mnt/usbdrive yourself.

So that the disk gets mounted on reboot add the following line to /etc/fstab:

/dev/sda1 /mnt/usbdrive ext3 defaults 0 0

This also means you can simply type:

mount /dev/sda1

when mounting the disk from the command line.

 <<O>>  Difference Topic UnixStuff (r1.3 - 07 Jun 2005 - ChrisJones)

META TOPICPARENT TechStuff
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html
Line: 8 to 8

dd if=/dev/urandom bs=1 count=128 | od -x
Added:
>
>
Solaris: psrinfo -v lists the processors on a box
 <<O>>  Difference Topic UnixStuff (r1.2 - 20 May 2005 - ChrisJones)

META TOPICPARENT TechStuff
Added:
>
>
Linux tcp tuning: http://www-didc.lbl.gov/TCP-tuning/linux.html



Generate random numbers on linux:

dd if=/dev/urandom bs=1 count=128 | od -x

 <<O>>  Difference Topic UnixStuff (r1.1 - 06 May 2005 - ChrisJones)
Line: 1 to 1
Added:
>
>
META TOPICPARENT TechStuff
Generate random numbers on linux:

dd if=/dev/urandom bs=1 count=128 | od -x


Revision r1.1 - 06 May 2005 - 15:29 - ChrisJones
Revision r1.22 - 12 Dec 2006 - 15:22 - ChrisJones