Power Tools

Fix Windows Line Endings from the Command Line

Use the dos2unix command to change Windows line endings to Unix line endings. To replace an existing file with a “fixed” file, type:

dos2unix file_name.txt

To create a new fixed version of the file, type:

dos2unix -n source_file.txt target_file.txt

Fast Arguments

Use the simple command/argument !$ (bang dollar) to reuse the last argument of your previous command, which is generally a filename. For instance, if you just ran the command:

cat /etc/passwd

you can run a different command, like vi, against the same file:

vi !$

is the same as:

vi /etc/passwd

If you want to reuse all the previous arguments, use !* (bang star). Say you just ran:

touch file1 file2 file3

To reuse the arguments, command:

vi !*

Make Your Commands Play Nice

To run a processor-intensive command without grabbing all the resources of the server, simply put nice before your command:

nice find / -name *.txt

See the nice section for more details.

Use Your public_html Directory for File Sharing

If you don’t have one in your home directory, create a public_html directory:

mkdir public_html

Now drop down into it:

cd public_html

Once you’re there, create a subdirectory:

mkdir sharedir

Set permissions:

chmod 755 sharedir

Put your files in it:

cp ~/sharedfile.txt sharedir

No file may be named index.htm[l] or default.asp.

Set their permissions:

chmod 644 sharedir/*

Give people the path to this directory. They will see a list of files, and can download them simply by clicking.

See Sharing files through the web by José R. Valverde at http://www.es.embnet.org/Doc/FAQ/www/.