User Tools

Site Tools


linux:intro-to-bash-part-1

Intro to Bash

Brief History

Date: Fri Aug 31 2018

  • Written by Brian Fox for the GNU Project
  • Based on the Bourne Shell (sh or /bin/sh) by Stephen Bourne, thus Bash is the Bourne-Again Shell
    • introduced scripting language abilities
  • sh is based on the Thompson shell, written by Ken Thompson, the co- inventor of Unix

Command Commands

  • ls : list command; list directory contents
  • cat : concatenate files and print on the standard output
  • cp : copy files and directories
  • mv : move (rename) files
  • rm : remove files or directories
  • rmdir : remove empty directories
  • mkdir : make directories
  • chmod : change file mode bits
  • ln : make links between files
  • man : an interface to the on-line reference manuals
  • info : read Info documents
  • chgrp : change group ownership
  • date : print or set the system date and time
  • df : report file system disk space usage
  • more : file perusal filter for crt viewing
  • less : opposit of more
  • pwd : print name of current/working directory
  • sudo : execute a command as another user (generally as superuser)
  • su : change user ID or become superuser
  • uname : print system information
  • grep : print lines matching a pattern
  • nano : Nano's ANOther editor, an enhanced free Pico clone
  • ed : line-oriented text editor / The GNU ed line editor (interactive / shell scripts)
    • info ed : "Ed is the 'standard' text editor in the sense that it is the original editor for Unix, and thus widely available"

Bash builtins

  • help : display information about builtin commands
  • echo : write arguments to the standard output
  • printf : formats and prints arguments under control of the format
  • read : read a line from the standard input and split it into fields
  • type : display information about command type
  • alias : define or display aliases

File Hierarchy

  • /dev : directory is the location of special or device files
  • /etc : contains configuration files
  • /home : user home directories
  • /lib : contains shared libraries needed to boot system and run commands in the root filesystem (e.g., in /bin and /sbin)
  • /media : mount point for removeable media
  • /mnt : mount point for temorarily mounted filesystem
  • /opt : add-on application software packages
  • /root : home directory for the root user
  • /sbin : system binaries
  • /srv : data for services provided by this system
  • /tmp : temporary files for applications, etc. lost app close or rebooting
  • /usr : user commands/binaries, and libraries
  • /var : contains variable data: logs, websites, system mail, application cache
  • / : root directory (all directories are a subset of this one)
  • /bin : essential user command binaries (for all users)
  • /proc : process and system info

Bash Files

  • /bin/bash : the bash executable
  • /etc/profile : the systemwide initialization file, executed for login shells
  • /etc/bash.bashrc : systemwide per-interactive-shell startup file
  • /etc/bash.bash.logout : systemwide login shel cleanup file, when login shell exits
  • ~/.bash_profile : personal init file for login shells
  • ~/.bashrc : individual per-interactive-shell startup file
  • ~/.bash_logout : individual login shell cleanup file, when login shell exits
  • ~/.inputrc : individual readline init files
linux/intro-to-bash-part-1.txt · Last modified: 2019/01/21 11:04 by seanburns