CLI (Command Line Interface) 1

Garam·2023년 7월 30일
0

The Odin Project

목록 보기
1/14

http://swcarpentry.github.io/shell-novice

내용정리


$ (% in Mac)

Shell is waiting for input.


$ ls

Listing → Lists the contents of the current directory.


$ pwd

Print Working Directory → Shows current working directory


/ (slashes)

  • At the front of a file or directory name = the root directory
  • Inside a path = just a separator


$ ls -F

  • Tells ls to classify the output by adding a marker to file and directory names to indicate what they are.
  • ‘/’ 구분자 있으면 directory, 없으면 파일.
  • @: a link
  • *: an executable


$ ls — help

도움말


$ man ls

List of its manual


$ ls -F Desktop

It works when a directory Desktop exists in my current working directory.

Typically, a Desktop directory exists in your home directory, which we assume is the current working directory of your bash shell.


$ cd Desktop
$ cd folder-1 (wherever you want to move to, in Desktop)

It changes the shell’s current working directory.
If we run pwd after it, we will see the folder-1’s path.


$ cd ..

  • Moving up one directory level. Parent of the current directory. ($ cd 상위폴더를 입력하면 에러가 뜬다.)
  • .. = A special directory name meaning “the directory containing this one”


$ cd (without giving a directory)

Returns to the home directory. (Use it when you’re lost in the filesystem)


$ ls -F -a

  • = ls -Fa
  • -a = show all
  • It forces ls to show us file and directory names that begin with .
  • . = The current working directory


~ (tilde character)

The current user’s home directory.
If my home directory is /Users/sally, then ~/data = /Users/sally/data



- (dash character)

The previous directory I was in.



cd .. vs cd -

The former brings you up, while the latter brings you back.



= A listing of files and directories in the root directory (/)



- (short options) vs -- (long options)

  • Short options: Use when typing commands directly into the shell. It is to minimise keystrokes and get your task done faster
  • Long options: Use in script to provide clarity




0개의 댓글