Administering Networking OS — Command Lines #4

College Online Material

Ghifari Nur
netSHOOT
2 min readMar 16, 2021

--

Dataquest

CLI or Basic Shell

The CLI

  • Text-based interface
  • Access via a terminal (GUI and Virtual)
  • Commands passed to a shell
  • Shell prompt (sysadmin@localhost/~)

Shell Features

  • Command history — the ability to re-execute previous commands quickly
  • Scripting — create programs by placing the command
  • Alias — create a shortcut to longer commands
  • Variables — store info that can be used to modify the functionality of the shell or commands

Understanding Command Structure

Command Format

  • Basic format

Option change the behavior of commands

Arguments are used to provide addition info for a command

Command Options

  • Vary based on command
  • Older option formate: -a
  • Newer (GNU) option format: — all

Command History

  • View the previous command: history
  • Bring up the previous command up arrow
  • Modify previous commands: left right
  • Execute a previous command: !<num>

Variables

Shell Variables

  • Use to store the sys. info
  • View with the echo command
  • Modify
  • Place command in ~/.bashrc to make permanent

Path Variable

  • Determines where command are execute

Command Path

Find Command

  • Hard to determine where a command is located
  • Instead of searching directories in the PATH variable manually, use the which command

Additional Command Structure

Globbing

  • used to match sets of files in a dir.
  • * match zero or more of any char.
  • ? match exactly one of any char.
  • [] match exactly one of a set of char.

Quoting

  • Double quotes — used to disable the meaning of some metachar. like globbing
  • Single quotes — used to disable the meaning of all metachar.

can use \ to disable next char. only

Control Statement

  • The ; char.— used to separate commands on a CLI
  • The && char. — used to execute the second command if the first command succeds
  • The || char. — used to execute the second command if the first command fails

--

--

netSHOOT
netSHOOT

Published in netSHOOT

Digital publications that discuss the everyday configuration and troubleshoot network devices and server

Ghifari Nur
Ghifari Nur

Written by Ghifari Nur

cheerful engineer with his notes