Chapter 7 Linux Command Line Interface (CLI)

This document covers basic linux shell commands used frequently when working with Ubuntu’s Command Line Interface (CLI).

7.1 Getting Help Documentation

  • [command] --help: Gets you the help documentation for a particular command including a list of the options and usage.

7.3 Directory/File Modification Commands

  • mkdir : Used to create a directory if not already exist. It accepts directory name as input parameter
  • cp : This command will copy the files and directories from source path to destination path. It can copy a file/directory with new name to the destination path. It accepts source file/directory and destination file/directory.
  • mv : Used to move the files or directories. This command’s working is almost similar to cp command but it deletes copy of file or directory from source path.
  • rm : Used to remove files or directories.

7.4 Display File Contents

  • cat: It is generally used to concatenate the files. It gives the output on the standard output.
  • head: Used to print the first N lines of a file. It accepts N as input and the default value of N is 10. head -6 file.txt will show the first 6 lines of a file.
  • tail: Used to print the last N-1 lines of a file. It accepts N as input and the default value of N is 10. tail -6 file.txt will show the last 5 lines of a file.

7.5 Permissions

  • sudo: Requried for performing actions that require root or superuser permissions.
  • chmod: Change the access permissions of files and directories. Common Codes:
    • Code List:
      • 0: No permission
      • 1: Execute permission
      • 2: Write permission
      • 3: Write and execute permissions
      • 4: Read permission
      • 5: Read and execute permissions
      • 6: Read and write permissions
      • 7: Read, write and execute permissions
    • 777 to make file readable, executable, and writable by:
      • User = 7: read, execute, write
      • Group = 7: read, execute, write
      • Other = 7: read, execute, write
    • 755 to give everyone read/execute and make file owner permission to write to the file.
      • User = 7: read, execute, write
      • Group = 5: read, execute
      • Other = 5: read, execute

7.6 Connecting to & Disconnecting from EC2 Terminal

Applies to Mac/Linux users. Windows users will use Putty.

  • ssh - Go to AWS EC2 instance and select “Connect”. You will get a connection string.
  • exit - Exits the AWS EC2 Terminal



Become a Expert Shiny Developer with AWS

Business Science



Have a question? Leave a comment.