Basic commands

  • cp <source-file>  <destination-file>
    Copies the file
  • scp <source-file> <destination-file>
    Copies file from one host machine to another host machine.
  • mv <source-file> <destination-file>
    Moves the file/folder from one place to other.
  • touch <file>
    Creates the file
  • mkdir <directory-name>
    Creates the directory. If you want to create a chain of parent and child directory you can use with ‘-p’ option. e.g  mkdir -p code/reference, this command will create reference directory under code directory.
  • rm <file-name>
    Deletes the file. If use with -r option, it recursively deletes the file and child directory
  • rmdir <directory-name>
    Deletes the empty directory.
  • grep <pattern> <file-name>
    Looks for the pattern in given file.
  • cat <file-name>
    Prints the content of the file on the console.
  • find <directory -name <file-name>
    This try to find file/directory in the given directory. Regular expression can be used for the file name.
  • ls [directory-name]
    Lists the files/directories present in the given directory.
  • pwd
    Prints the the path of the current directory.
  • jar -tvf <jar-file-name>
    Lists the files present in the jar file.
  • man <command>
    This provides you the manual of the command. Very handy, if you want to know about the command options.
  • sudo apt-get install <package-name>
    Installs the package.
  • sudo dpkg -i <package-name>
    Installs the package.
  • sudo dpkg -r <package-name>
    Removes the package.
  • If you are using git for source control then check these git commands.

Miscellaneous

  • wget <URL>
    Downloads the file from the specified URL.
  • tcpdump [options]
    Dumps the network packets on the console. Very handy when you are debugging the network application.
  • curl <URL>
    This command shows you the HTTP ouput of the url. This command is similar to wget command.
  • tree
    Lists the directory structure in tree form. If the command doesn’t work then install it using this command sudo apt-get install tree. Sometime handy when you want to see what all files have been created by the application in a directory.
  • chmod [options] <file-name>
    changes the file permissions.
  • /etc/init.d/<service-Name> start or service <service-name> start
    Starts the service, but should have sudo permission.
  • /etc/init.d/<service-Name> stop or service  <service-name> stop
    Stops the service but should have sudo permission.
  • Ctrl + Alt + T
    Launches the terminal
  • Ctrl + L
    to clean the screen as good as typing “clear”
  • Ctrl+A or Home button
    Takes you to beginning of the command
  • Ctrl+U
    Erase the command
  • Ctrl+E or End button
    Takes you to end of the command
  • Ctrl+Shift+C
    Copies the select string from terminal
  • Ctrl+Shift+V
    Pastes the string on the terminal
  • head <file-name>
    Prints the few lines from the beginning of the file
  • more <file-name>
    Prints the file content in page-by-page basis.
  • tail <file-name>
    Prints the few lines from the end of the file. If the command is used with -f , the  output get appended data as the file grows. Helpful when you try to see the log file.
  • alias <customized_command>='<formal command>'
    Really handy command to rename the long command to customizable short command.
  • printenv or echo $<Environment variable>
    Prints the environment variables value.
  • ip addr
    Reports on your system’s network interfaces.
  • ifconfig
    Helps to configure a network interface
  • fsck
    Checks the file system.
  • sudo <command> 
    Help to Execute Commands with elevated privileges
  • ps -aux
    Lists the current running process on your system.
  • kill -9 processid
    Kills the specified process.

Utility commands

  • xcalc
    if you are on GNOME; Shows the calculator.
  • cal
    Shows the Calendar
  • date
    Shows the current date and time

Commands for fun ;)

  • apt-get moo
    Checkout yourself what it does.
  • cowsay "<message-string>"
    If the command is not found then install it using this command sudo apt-get install cowsay
  • alt+f2 "free the fish"
    If you use GNOME. This command doesn’t work if you are using Ubuntu 12.04 or 12.10
Trackback

no comment untill now

Add your comment now