Linux

Adding the "-a" option to the ifconfig command will show all of the ethernet devices installed on the computer:

ifconfig -a

The ifconfig command allows you to a whole lot more to configure your network interfaces, for additional options you can always check the Linux manual from the command line or you can visit the ComputerHope article on the command.

I haven't had to use this one much since most of the time there is a GUI representation of this available, but it does help to find out how much hard drive space you are currently using.

df -k

Very simple usage of the "cp" command:

# copy and preserve modification date of a file:
cp -p filename /copy/to/directory

tar options (and their meanings):

# (extract archive contents)
-x
--extract

# (list archive contents)
-t
--list

# (make new tar archive)
-c
--create

# (specify name of archive file)
-f
--file

# (show the files being worked on as the tar is being performed)
-v
--verbose

find options:

# (for greater than n)
+n
# (for less than n)
-n
# (for exactly n)
n
# (last modified n minutes ago)
-mmin n
# (last modified n*24 hours ago)
-mtime n
# (pattern represents a filename string to look for, may also contain special regular expression characters)
-name pattern
# (replace c with a d, for directory or f, for a regular file)
-type c
# (allows you to execute commands on every file found by the find command, very useful. You can use the special token {} which represents the current filename)
-exec
# (tells the find command how many folder levels to recurse through, use a 1 to only pick up files from the current directory)
-maxdepth n

Examples of using the find command

# returns all files matching the pattern created in the last 14 days
find -name 'var1*' -mtime -14

# returns all files over 14 days old
find -name 'var1*' -mtime +14

# finds all files matching the pattern and then executes the rm -R command on the file
# the final \ is necessary when using the -exec option because it signifies the end of the command you are trying to execute
find -name '_vti_cnf' -type d -exec rm -R {} \;

How to gzip a tar file:

gzip filename.tar

How to decompress a gzip file back to a tar file:

gunzip filename.tar.gz

How to create a .tgz file from a set of folders:

tar -czvf filename.tgz /folder/to/backup

How to decompress a .tgz file:

tar -xzvf archive.tgz

How to extract files from a compressed tarball:

# extract to same directory
tar -xzf archive.tar.gz

# extract to a specific directory
tar -xzf archive.tar.gz -C /location/to/extract/to

How to list files in tar or compressed tar file

tar -tf archive.tar
tar -tzf archive.tar.gz

How to tell which versions of tar and gzip are installed on your machine:

tar --version

gzip -v

You can type in the following at the command line to get the version of Redhat you are running:

cat /etc/redhat-release

Unfortunately, this method doesn't tell you whether you are running a 32-bit or 64-bit version of the operating system. In order to find out this information you could use the following command:

uname -a
mysql -V

php -v

perl -v