File and directory management
Command | Description |
---|---|
| The file content is read out Space bar = next page, b = previous page, q = exit / = forward search, ? = backward search, n = repeat search |
| Shows all lines containing the specified string; -i= is case sensitive. |
| Counts the lines in the file. |
| Particularly useful for log files. The last 10 lines of the file are displayed. The parameter -f also displays newly added lines. Exit with ^C. |
| This can be used to adjust the number of lines that are output. Example: tail -n <file> shows only the last line of the file. |
| Extracts strings from a binary file. |
| Creates a file if not already present, or updates the timestamp. |
| Delete file. |
| Copy file. |
| Copy one or more files to another directory. The trailing slash after <path> is not essential, although it prevents errors when copying a file if the path does not exist. |
| Rename file or directory. |
| Move one or more files to a directory. |
| Create a hard link from <file> to <user> (both names point to the same inode of the file system). Both names must be on the same file system. |
| Make <user> a symbolic or soft link that points to the path that can be a file or directory and can be anywhere in the file system. |
Command | Description |
---|---|
| Displays permissions for files or directories. -rwxrwxrwx For a file: r allows reading; w allows writing/attaching; x allows executing. For a directory: r allows listing of content; w allows creating or deleting files within the directory; x allows entering the directory. |
| Directories are displayed like files. Without -d, the directory content is listed recursively when directories are entered. |
| Changing the owner, group or both of a file or directory. |
| Adding or removing permissions. u = user (owner), g = group, o = others, a = all (ugo) e.g. "chmod go+r file" adds the permission 'r' to 'group' and 'others’. |
| Change all bits simultaneously to the octal value nnn. e.g. "chmod 640 file" sets rw- for user, r-- for group, --- for others. 0 --- 1 --x 2 -w- 3 -wx 4 r-- 5 r-x 6 rw- 7 rwx |
| Show or set the file creation mask for this session; these are the permission bits that are not set for newly created files. For example, “umask 022” means that newly created files have no more than rwxr-xr-x permissions. |
Command | Description |
---|---|
| Finds all files under the specified path. Use "." for the current directory. Use the option |
| Finds all files under the specified path whose name begins with "placeholder. |
| Find all files under the path and apply |
| Secure version of the above command, and works with file names containing spaces. |
Command | Description |
---|---|
| Reads a compressed text file without unpacking it on the hard disk. |
| Shows the contents of the compressed tar archive. Add option |
| Extract the contents of the compressed archive to the specified directory, otherwise to the current directory. |
Command | Description |
---|---|
| Display current directory. |
| Change to a subdirectory of the current directory. |
| Move up one level to the parent directory. |
| Change current directory: to the root directory, to an absolute path, to the home directory of a particular user, or to your own home directory. |
| Lists the contents of the current directory or the specified directory. |
| Lists the directory in long form. |
| Lists all files, including hidden files. |
| Lists the directory itself, instead of its contents. |
| Sample for the combination of flags. |
| Create a directory. |
| Delete an empty directory. |
| Recursively delete a directory and its entire contents. |