加载中...

Linux命令行大全|读书笔记


Book Notes: The Linux Command Line - Chapter 5


About this Book 📚

Name: The Linux Command Line

Author: William E. Shotts

Publisher: No Starch Press

Cover:

The Linux Command Line

Translation Version:

Linux命令行大全


Notes ✍️

4 Types of Commands

  • An executable program
    • All files we saw in /usr/bin are executable programs. Within this category, programs can be compiled binaries such as programs written in C and C++, or programs written in scripting languages such as the shell, Perl, Python, Ruby, and so on.
  • A built-in command
    • A command built into the shell itself. bash supports a number of commands internally called shell builtins. The cd command, for example, is a shell builtin.
  • A shell function
    • Shell functions are miniature shell scripts incorporated into the environment.
  • An alias
    • Aliases are commands that we can define by ourselves, built from other commands.

Commands of Chapter 5

  • type

    • Display information about command type
    • Examples
      • type ls
      • type cd
      • type mv
  • which

    • Display an Executeable’s Location
    • Examples
      • which ls
      • which cp
  • help

    • Display information about built-in commands
    • Examples
      • help cd
  • --help

    • Display a description of the command’s supported syntax and options
    • Examples
      • mkdir --help
      • mv --help
  • man

    • Display a program’s mannual page
    • Examples
      • man mv
  • whatis

    • Display one-line manual page descriptions
      • whatis mv
      • whatis cp
  • alias

    • Create an alias for a command
    • 🍉 PS: The alias commands disappear when shell session ends, but we will learn how to store them for future use in later chapters.

Lab 🧑🏻‍💻

Why Labs ?

Lab provides a hands-on learning experience that allows us to apply theoretical knowledge to practical situations. This helps us to better understand concepts and retain information more effectively.

Lab1

use type , which, help, whatis, man to check fundamental commands

  • pwd
  • cd
  • ls
  • mkdir
  • cp
  • mv
  • rm
  • less
  • file

Lab2

Prerequisites

Try using ; to write commands in 1 line

cd; cd Desktop;

Task

Use alias to change current directory to Desktop

type cdd # check if 'cdd' is used
alias cdd='cd; cd Desktop;' # if not, assgin these command lines to 'cdd'
cdd # use this command

文章作者: Rickyの水果摊
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Rickyの水果摊 !
  目录