Linux Basics

  • a file is a collection of data with a name (a filename to be precise). Although it may be stored in separate chunks in different location on the hardware, programs will generally work with a file as a single continuous collection of data.
  • a directory is construct for grouping and organizing files. In UNIX and Linux, directories can contain, files, other directories, links and devices. You may be use to calling directories folders or namespaces.
  • a path is a way of naming the location of a file, directory, link or device. Paths can be relative or absolute and are often used as the prefix to a filename. For example, if I want to list the contents of a directory that is in my home directory called cheese, I can type:
    ls ~/cheese/
  • a link is a filesystem pointer. You may be use to calling a link an alias or a shortcut
  • ls: lists the files in your current working directory for that shell.
    • more ways: ls -a, ls -l, ls -la
  • cd directory : changes the current working directory to directory where directory may be a fully qualified path. A ~ indicates your home directory. ~bob indicates the home directory of bob.
  • rm filename : removes the file filename where filesname may be a fully qualified path
  • cp source destination : copies the file source to the file destination where source and destination may be fully qualified paths.
  • mv source destination : the same as cp, but it moves the source file instead of copying it. mv can also be used to rename a file with mv oldname newmane
  • chmod #### file or directory : changes the file or directory permissions for letter yourself and other people access your files. see man chmod for more info.
  • Printing: the lpr command is the basic printing command. in your shell, type: “lpr filename ” to print the file filename to the printer specified in printername or “lpq” to get a list of jobs sent to the printer.
  • File compression: “gzip filename” will compress the file filename and give it the .gz name extension. “gzip -d filename.gz” or “gunzip filename.gz” will decompress the file and remove the .gz extension.