A quick way to get a summary of the available and used disk space on your Linux system is to type in the df command in a terminal window. The command df stands for ” d isk f ilesystem”. With the -h option (df -h) it shows the disk space in “human readable” form, which in this case means, it gives you the units along with the numbers.
The output of the df command is a table with four columns. The first column contains the file system path, which can be a reference to a hard disk or another storage device, or a file system connected through the network. The second column shows the capacity of that file system. The third column shows the available space, and the last column shows the path on which that file system is mounted. The mount point is the place in the directory tree where you can find and access the that file system.
The du command on the other hand shows the disk space used by the files and directories in the current directory. Again the -h option (df -h) makes the output easier to comprehend.
By default, the du command lists all subdirectories to show how much disk space each has occupied. This can be avoided with the -s option (df -h -s). This only shows a summary. Namely the combined disk space used by all subdirectories. If you want to show the disk usage of a directory (folder) other than the current directory, you simply put that directory name as the last argument. For example: du -h -s images, where “images” would be a subdirectory of the current directory.
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication.
Any file name may contain a host and user specification to indicate that the file is to be copied to/from that host. Copies between two remote hosts are permitted.
The options are as follows:
- -c cipher
- Selects the cipher to use for encrypting the data transfer. This option is directly passed to ssh(1).
- -i identity_file
- Selects the file from which the identity (private key) for RSA authentication is read. This option is directly passed to ssh(1).
- Preserves modification times, access times, and modes from the original file.
- Recursively copy entire directories.
- Verbose mode. Causes scp and ssh(1) to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.
- Selects batch mode (prevents asking for passwords or passphrases).
- Disables the progress meter.
- Compression enable. Passes the –C flag to ssh(1) to enable compression.
- -F ssh_config
- Specifies an alternative per-user configuration file for ssh This option is directly passed tossh(1).
- -P port
- Specifies the port to connect to on the remote host. Note that this option is written with a capital `P’ because –p is already reserved for preserving the times and modes of the file inrcp(1).
- -S program
- Name of program to use for the encrypted connection. The program must understand ssh(1) options.
- -o ssh_option
- Can be used to pass options to ssh in the format used in ssh_config5. This is useful for specifying options for which there is no separate scp command-line flag. For example, forcing the use of protocol version 1 is specified using scp -oProtocol=1
- Forces scp to use IPv4 addresses only.
- Forces scp to use IPv6 addresses only.
rcp(1), sftp(1), ssh(1), ssh-add1, ssh-agent1, ssh-keygen1, ssh_config5, sshd(8)
Important: Use the man command (% man) to see how a command is used on your particular computer.
The following examples illustrate typical uses of the command zip for packaging a set of files into an “archive” file, also called “zip file”. The command uses the standard zip file format. The archive files can therefore be used to transfer files and directories between commonly used operating systems.
zip archivefile1 doc1 doc2 doc3
This command creates a file “archivefile1.zip” which contains a copy of the files doc1, doc2, and doc3, located in the current directory.
zip archivefile1 *
This command creates a file “archivefile1.zip” which contains a copy of all files in the current directory in compressed form. However, files whose name starts with a “.” are not included. The extension “.zip” is added by the program.
zip archivefile1 .* *
This version includes the files that start with a dot. But subdirectories are still not included.
zip -r archivefile1 .
This copies the current directory, including all subdirectories into the archive file.
zip -r archivefile2 papers
This copies the directory “papers”, located in the current directory, into “archivefile2.zip”.
zip -r archivefile3 /home/joe/papers
This copies the directory “/home/joe/papers” into “archivefile3.zip”. Since in this case the absolute path is given, it doesn’t matter what the current directory is, except that the zip file will be created there.
The command unzip extracts the files from the zip file.
This writes the files extracted from “archivefile1.zip” to the current directory.