Previous Page | Next Page

  1. Introduction

    Files and File Structure

  2. File Structure
  3. Configuration Files
  4. File Formats

    Commands

  5. Filesystem Management
  6. File Management and Viewing
  7. Help, Job and Process Management
  8. Network Management
  9. System Management
  10. User Management
  11. Printing and Programming
  12. Document Preparation
  13. Miscellaneous
  14. Credits

Linux File Management and Viewing

File and Directory management

aproposSearch the whatis database for files containing specific strings.
bdflushKernel daemon that saves dirty buffers in memory to the disk.
cdChange the current directory. With no arguments "cd" changes to the users home directory.
chmodchmod <specification> <filename> - Effect: Change the file permissions.
Ex: chmod 751 myfileEffect: change the file permission to rwx for owner, re for group
Ex: chmod go=+r myfileEffect: Add read permission for the owner and the group
character meanings u-user, g-group, o-other, + add permission, - remove, r-read, w-write,x-exe
Ex: chmod a +rwx myfileEffect: Allow all users to read, write or execute myfile
Ex: chmod go -r myfileEffect: Remove read permission from the group and others
chmod +s myfile - Setuid bit on the file which allows the program to run with user or group privileges of the file.
chmod {a,u,g,o}{+,-}{r,w,x} (filenames) - The syntax of the chmod command.
chownchown <owner1> <filename> Effect: Change ownership of a file to owner1.
chgrpchgrp <group1> <filename> Effect: Change group.
cksumPerform a checksum and count bytes in a file.
cp cp <source> <destination> Copy a file from one location to another.
ddConvert and copy a file formatting according to the options. Disk or data duplication.
dirList directory contents.
dircolorsSet colors up for ls.
fileDetermines file type. Also can tell type of library (a.out or ELF).
findEx: find $Home –name readme Print search for readme starting at home and output full path.
How to find files quickly using the find command:
Ex: find ~ -name report3 –print
  • "~" = Search starting at the home directory and proceed through all its subdirectories
  • "-name report3" = Search for a file named report3
  • "-print" = Output the full path to that file
installCopy multiple files and set attributes.
lnMake links between files.
locateFile locating program that uses the slocate database.
losetupLoopback device setup.
ls List files. Option -a, lists all, see man page "man ls"
Ex: "ls Docum Projects/Linux" - The contents of the directories Docum and Projects/Linux are listed.
To list the contents of every subdirectory using the ls command:
  1. Change to your home directory.
  2. Type: ls -R
mkdirMake a directory.
mknodMake a block or character special file.
mktempMake temporary filename.
mvMove or rename a file. Syntax: mv <source> <destination> Ex: mv filename directoryname/newfilename
pathchkCheck whether filenames are valid or portable.
pwdPrint or list the working directory with full path (present working directory).
rmEx: "rm .*" - Effect: Delete system files (Remove files) –i is interactive option.
rmdirrmdir <directory> - Remove a directory. The directory must be empty.
slocateProvides a secure way to index files and search for them. It builds a database of files on the system.
stat(1u)Used to print out inode information on a file.
sumChecksum and count the blocks in a file.
testCheck file types and compare values.
touchChange file timestamps to the current time. Make the file if it doesn't exist.
updateKernel daemon to flush dirty buffers back to disk.
vdirList directory contents.
whatisSearch the whatis database for complete words.
wherisLocate the binary, source and man page files for a command.
whichShow full path of commands where given commands reside.

File viewing and editing

edEditor
emacsFull screen editor.
gitviewA hexadecimal or ASC file viewer.
headhead linuxdoc.txt - Look at the first 10 lines of linuxdoc.txt.
jedEditor
joeEditor
lessq-mandatory to exit, Used to view files.
moreb-back q-quit h-help, Used to view files.
picoSimple text editor.
tail tail linuxdoc.txt - Look at the last 10 lines of linuxdoc.txt.
viEditor with a command mode and text mode. Starts in command mode.

File compression, backing up and restoring

arCreate modify and extract from archives.
bunzip2Newer file decompression program.
bzcatDecompress files to stdout.
bzip2Newer file compression program.
bzip2recoverRecovers data from damaged bzip2 files.
compressCompress data.
cpioCan store files on tapes. to/from archives.
dumpReads the filesystem directly.
gunzip unzip <file> - unzip a gz file.
gzexeCompress executable files in place.
gzip gzip <file> - zip a file to a gz file.
mtControl magnetic tape drive operation.
tarCan store files on tapes.
Usage: tar cvf <destination> <files/directories> - Archive copy groups of files
Ex: tar /dev/fdo temp Effect: Copy temp to drive A:
uncompressExpand data.
unzip unzip <file> - unzip a zip file. Files ending in ".gz" or ".zip" are compressed.
zcatUsed to restore compressed files.
zcmpCompare compressed files.
zdiffCompare compressed files.
zforceForce a .gz extension on all gzip files.
zgrepSearch possibly compressed files for a regular expression.
zmoreFile filter for crt viewing of compressed text.
znewRecompress .z files to .gz files.
zipzip <file> - make a zip file.

Extra control and piping for files and other outputs

basenameStrip directory and suffix information from filenames.
catEx: cat < filename --- Effect: put keyboard input into the file. CTRL-D to exit (end).
cmpCompare two files.
colrmRemove columns from a file.
columnColumnate lists.
commEx: comm file1 file2 --- Effect compare the contents of file1 and file2 produces 3 columns of output. Lines in the first file, lines in second file, lines in both files.
csplitSplit a file into sections determined by context lines.
cutRemove sections from each line of files.
diffShow the differences between files. Ex: diff file1 file2
diff3Find differences between 3 files.
dirnameStrip the non-directory suffix from a filename.
echoDisplay a line of text.
egrepSimilar to grep -E, compatible with UNIX egrep.
expandConvert tabs to spaces.
exprEvaluate expressions.
falseDo nothing. Exit with a status indicating failure.
fgrepSame as grep -F.
foldWrap each input line to fit in specified width.
joinJoin lines of two files in a common field.
grep grep pattern filename.
Ex: grep " R " --- Effect: Search for R with a space on each side
Ex: ls –a |grep R --- Effect: List all files with an R in them or their info listing.
hexdumpasc, decimal, hex, octal dump.
lognamePrint user's login name.
lookDisplay lines beginning with a given string.
mkfifoCreate named pipes with the given names.
nlWrite each file to standard output with line numbers added.
odDump files in octal and other formats.
patchApply a diff file to an original.
pasteCombines from 2 or more files. Ex: paste file1 file 2
printfPrint and format data.
revReverses lines in a file.
scriptMake a typescript of a terminal session.
sdiffFind differences between 2 files and merge interactively.
sedA stream editor. Used to perform transformations on an input stream.
sleepDelay for a specified amount ot time.
sortSort a file alphabetically.
splitSplit a file into pieces.
stringsPrint the strings of printable characters in files.
tacConcatenate and print files in reverse.
teeRead from standard input and write to standard output and files.
trTranslate or delete characters.
trueDo nothing. Exit with a status indicating success.
tsortPerform topological sort.
ulDo underlining.
unexpandConvert tabs to spaces.
uniqRemove duplicate lines from a sorted file.
uudecodeUsed to transform files encoded by uuencode into their original form.
uuencodeEncode a binary file to be sent over a medium that doesn't support non-ASC data.
wcCount lines, words, characters in a file. Ex: wc filename.
xargsBuild and execute command lines from standard input.
yesOutput the string "y" until killed.