Linux Commands

From Danleff Wiki
(Redirected from Linuxcommands)
Jump to: navigation, search

--Danleff (talk) 14:12, 21 July 2014 (PDT)

File/Directory Commands

Administrative access

username ALL=(ALL) ALL

  • To provide sudo access to a group, add the following line to the /etc/sudoers file.

%programmers ALL=(ALL) ALL

  • Remove a directory, even if files existed in that directory.
  1. rm -r directory
  2. add -f switch to prevent warning prompts.
  3. rm -rf dir – force remove directory dir *


File Compression

  1. tar xzf file.tar.gz – extract a tar using Gzip
  2. tar xf file.tar – extract the files from file.tar
  3. tar xjf file.tar.bz2 – extract a tar using Bzip2



File Permissions

  • chmod 777 – read, write, execute for all
  • chmod 755 - wide open for user, read and executable for everyone else
  • chmod 644 - read and writable for user, readable by everyone else
    • numerical meanings
  1. 7 = 4+2+1 (read/write/execute)
  2. 6 = 4+2 (read/write)
  3. 5 = 4+1 (read/execute)
  4. 4 = 4 (read)
  5. 3 = 2+1 (write/execute)
  6. 2 = 2 (write)
  7. 1 = 1 (execute)chmod 755 – rwx for owner, rx for group and world
  1. rpm -q kernel
  2. yum remove <filename>
  3. yum list kernel-* will give you a list of installed and available packages.


  • List disk space usage
  1. df -Th
  • To list the drives and relevant partitions that are attached to your system, run:
  1. sudo fdisk -l