Rails Noob's Notes

Because my memory is good but short.

Linux

Tar

Creating an archive from a directory.

tar -czvf archive.tar.gz directory/

Or just

tar czf archive.tar.gz directory

Extracting.

tar -xzvf archive.tar.gz

Or even without the file format option.

tar xf archive.tar.gz

To use bzip2 instead of gzip use j option instead of z. For bzip2 the file extension convention is .bz2

List (test) the content of the archive.

tar tf archive.tar.gz

Finding files

List every files and directories (with relative paths) in the current directory and all its subdirectories.

find .

Or just

find

Same but just files.

find -type f

Just directiories.

find -type d

Search in the home directory (and all its subdirectories).

find ~

In the /mnt and /media directories.

find /mnt /media

Find something named config.

find -name "config"

Find all ruby files in the home directory.

find ~ -type f -name "*.rb"

Find all ruby files in the home directory, but not if they have letter "a" or "e" in their names.

find ~ -type f -name "*.rb" -not -name "*a*" -not -name "*e*"

Or

find ~ -type f -name "*.rb" ! -name "*a*" ! -name "*e*"

Debian/Ubuntu package management

Show the package description and status (is it isntalled or not).

dpkg -s <packagename>

This installation description is for Ubuntu.

sudo apt-get install curl

Using 7z

Split a file to 500 MB parts with no compression.

7z a -v500m -mx0 movie.7z movie.mp4