Useful Linux Commands

  • How to find out mount/partition a directory or file is on?
    $df -P file/goes/here | tail -1 | cut -d' ' -f 1
    $df –h
  • Patch a diff
    $patch [-C] –I <diff filename>
  • List all process
    $ps -aux
  • List eclipse packages and uninstall
    $dpkg --get-selections | grep eclipse
    $apt-get purge eclipse*
    $rm -r ~/.eclipse/
  • Install Java 7
    $add-apt-repository ppa:webupd8team/java
    $apt-get update
    $apt-get install oracle-java7-installer
    $apt-get install oracle-java7-set-default
  • Autostart Samba Server
    $apt-get install sysv-rc-conf sysvinit-utils
    $sysv-rc-conf smbd on
  • Copy files with Progress
    $rsync -avh --progress sourceDirectory destinationDirectory
  • disk space for current directory
    $stat -c '%m' .
    $df -k
    $du / --max-depth=1 -h
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s