Linux Cheat Sheet

Here is a very short summary on a few of the more important GNU/Linux commands and their definitions:

Working with Files

cp <filename> <new filename>
    copy - Make a copy of a file

cp -R <directory> <new directory>

    Make a copy of a directory

mv <filename> <new filename>

    move - Move or rename a file

rm <filename>
    remove - Delete a file

Working with Directories

cd <directory>
    change directory - Change to the directory specified

ls
    List - Lists the files in the current directory


ls -l

    Lists the files and their attributes

mkdir <new directory name>
    make directory - Create a new directory

pwd
    Path of working directory - tells you what directory you are in

 

Archiving/Extracting Files and Directories

 tar -zcvf  <filename> <directory>  # create  gzipped  tar  archive  of  <directory>

  • -z - filter the archive through gzip
  • -c -  create a new archive
  • -v - verbosely list files processed
  • -f - use archive file

 tar -xvzf  <filename>     # extract tarred, gzipped <filename> in current directory

  • -x - extract files from an archive
  • -v - verbosely list files processed
  • -z - filter the archive through gzip
  • -f - use archive file

Working with File Permissions:

chmod u+x <filename>
   changes permission of the named file to executable
.

  • u - user, (this means you)
  • + - adds permissions
  • x - executable rights

Comments