Vim and advanced bash: Summary of Basic Commands

Key Points

Introducing Vim
Shell Scripts
  • Save commands in files (usually called shell scripts) for re-use.

  • bash filename runs the commands saved in a file.

  • $@ refers to all of a shell script’s command-line arguments.

  • $1, $2, etc., refer to the first command-line argument, the second command-line argument, etc.

  • Place variables in quotes if the values might have spaces in them.

  • Letting users decide what files to process is more flexible and more consistent with built-in Unix commands.

Finding Things
  • find finds files with specific properties that match patterns.

  • grep selects lines in files that match patterns.

  • --help is a flag supported by many bash commands, and programs that can be run from within Bash, to display more information on how to use these commands or programs.

  • man command displays the manual page for a given command.

  • $(command) inserts a command’s output in place.

Permissions
  • FIXME

Job control
  • When we talk of ‘job control’, we really mean ‘process control’

  • A running process can be stopped, paused, and/or made to run in the background

  • A process can be started so as to immediately run in the background

  • Paused or backgrounded processes can brought back into the foreground

  • Process information can be inspected with ps

Shell Variables
  • FIXME

Summary of Basic Commands

Action Files Folders
Inspect ls ls
View content cat ls
Navigate to   cd
Move mv mv
Copy cp cp -r
Create nano mkdir
Delete rm rmdir, rm -r