Download digital camera photos with gphoto2

gphoto2 allows you to directly connect a digital camera over USB and transfer the saved images and videos to your computer. This is very helpful when you don’t have access to a media card reader.
Install the gphoto2 package on your system.
In Gentoo:

# emerge media-gfx/gphoto2

In Ubuntu:

# aptitude install gphoto2

Start off by connecting your digital camera to [...]

List all open files with lsof

The lsof command stands for “list open files”. It can show all open files as well as sockets, memory mapped libraries, directories, pipes, and network sockets. It is an incredibly powerful tool which you can use to gather detailed information about what is happening on your system.
If you run lsof as a normal user [...]

Search for files with the find command

The find command allows you to recursively search and locate files on your system based on specific criteria. You can search by name, owner, group, type, permissions, date, as well as many others.
The find command uses the following format:

find [search_path(s)] [search_criteria]

The following is the most basic way to run the find command. It will list [...]

View dynamic library dependencies with ldd

The ldd command allows you to view detailed information about library dependencies of dynamically linked programs and other shared libraries. ldd uses the runtime linker ld.so which reads the ELF formatted executable to generate the output. It is a helpful tool to have at your disposal when debugging broken programs.
Here ldd examines the ‘ls’ executable. [...]

Display the first part of a file with head

Similar to the tail command which shows you the last few lines of a text file, the head command lets you to quickly view the first few lines.
The head command syntax.

head [options] file

By default head will show you the first 10 lines of a text file.

$ head textfile.txt

You can change the number of lines displayed [...]

Display the last part of a file with tail

Similar to the head command which shows you the first few lines of a text file, the tail command lets you to quickly view the last few lines of a text file. It also supports a monitoring mode which displays ongoing changes within the file.
The tail command syntax.

tail [options] file

By default tail will show you [...]

Determine file type with the file command

The file command identifies the type or format of a file. It is a very handy command that can show you how to approach a file when the format is unknown. There are a variety of tests that it uses to determine its type, these tests include a filesystem test, magic number test, and [...]

Using tar to archive files

TAR is the GNU Tape ARchive utility. It is used to pack the contents of multiple files or directories in an archive file called a tarball. Tar can preserve directory organization including file ownership, permissions, links, as well as directory structure. To save space you can optionally enable compression with gzip, bzip2, or another external [...]

View program output with watch

Watch runs a program at regular interval and continuously displays the output. This allows you keep track of the changes that are occurring in the program over time.
Run watch in the following way.

watch [options] command

By default watch updates the command output every 2 seconds. To change this interval us the ‘-n seconds‘ [...]

Submit commands as root with sudo

Among the most valuable tools at a Linux administrators disposal is sudo. It lets ordinary users temporarily submit commands as root or another user.
To use use this command simply put sudo before any command you want to run with root permissions.

sudo command

To submit commands as another user use the ‘-u‘ option and the username. [...]