Wednesday, December 7, 2011

Cheat Sheet

Below is my linux terminal cheat sheet that I use often. I decided to post it mostly so I could easily find it myself. I seem to reference my own blog quite often to remember how I did something in the past. These are all just examples not command descriptions. I hope it is helpful...

Users, Groups, & Permissions
  • Create User Account
    • sudo adduser <username> # program that does everything for you
  • Modify User Account
    • sudo usermod -a -G <group> <username> #append user to a group
  • Delete User Account
    • ?
  • Change Permissions
    • chmod 755 <myfile>
    • chmod -R 755 <mydir> #applied permissions recursively on directory
  • Change Ownership
    • chown root:root /my/dir/path/
Working w/ Files
  • Create Empty Text File
    • >> <filename>
    • touch <filename>
  • Move Files
    • mv <oldfile> <newfile>
  • Rename Files
    • mv <oldfile> <newfile>
  • Delete File
    • rm <filename>
  • Delete Recursively w/ Wildcard
    • find . -type f -name '*.htm' -delete
  • Copy Files
    • cp <existing> <new>
  • Change line terminators
    • flip -ub <textfile>
  • Search results of standard output
    • grep <searchstring>
Working w/ Directories
  • Create Empty Directory
    • mkdir
  • Move or Rename
    • mv
  • Delete Directory Recursively
    • rm -R <folder> <newfolder>
  • Copy Recursively
    • cp -r <dir1> <dir2>
    • scp ...
    • rsync
Misc. Tools
  • Search Results of Standard Output:
    • grep <searchstring>
System Resources
  • View Memory Usage
    • free
  • Process Monitor
    • top
    • htop
  • Processes
    • ps -A
  • System Activity
    • vmstat
  • User Monitor
    • who
    • whoami
  • View Device Ids (UUID)
    • blkid
Package Management

  • Install
    • apt-get install <packagename>
  • Remove
    • apt-get remove <packagename>
  • Remove completely
    • apt-get remove --purge <packagename>
  • List all installed package
    • dpkg -l
  • See if a package is installed
    • dpkg -l | grep <packagename>
  • Find sources here:
    • sudo nano /etc/apt/sources.list
Networking
  • Find computers on network:
    • arp -av
Automation
  • Schedule tasks:
    • crontab -e
Tar and Zip Files & Directories
  • Tar Files
    • tar -cvpf <file.tar> <files or folder>
  • Tar Files and Zip
    • tar -zcvpf <file.tar.gz> <files or folder>
  • View  Tar
    • tar -ztvf <file.tar>
  • Untar Files
    • tar -xvpf <file.tar> <files or folder>
  • Untar Files w/ Zip
    • tar -xvpzf <file.tar.gz>

Links:

http://www.commandlinefu.com/commands/view/7159/recursive-remove-all-htm-files

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.