본문 바로가기

기타

VsCode 에서 Git Bash 쓰다 알면 좋은 점

[1]  내가 폴더로 이동하고 싶을때  

$ cd [이동하고 싶은 폴더 구조]

# 이전 경로로 이동하고 싶을떄
$ cd -

 

[2]  그 폴더에 무엇이 있는지 알고 싶을 때 

# ls : 이 폴더에 존재하는 파일 혹은 폴더를  리스트로 보여줘
andan@DESKTOP-LGLU6E9 MINGW64 ~/OneDrive/바탕 화면/nextjs 알아가기/nextjs-dashboard
$ ls

app/            package-lock.json   scripts/
next.config.js  postcss.config.js   tailwind.config.ts  
next-env.d.ts   prettier.config.js  tsconfig.json       
node_modules/   public/
package.json    README.md


# 만약에 숨겨진 폴더나 파일을 확인하고 싶다면  a 옵션을 
andan@DESKTOP-LGLU6E9 MINGW64 ~/OneDrive/바탕 화면/nextjs 알아가기/nextjs-dashboard
$ ls -a
./              .nvmrc          package.json        README.md
../             app/            package-lock.json   scripts/
.env.example    next.config.js  postcss.config.js   tailwind.config.ts
.eslintrc.json  next-env.d.ts   prettier.config.js  tsconfig.json     
.gitignore      node_modules/   public/

 

[3]    명령어의  상세 옵션이  무엇이 있는지  궁금할때

# 도움말을 찾고 싶은 명령어를 고르시고 다음과같은 --help 옵션을 넣어주세여

$ cd --help

cd: cd [-L|[-P [-e]] [-@]] [dir]
    Change the shell working directory.

    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable. If DIR is "-", it is converted 
to $OLDPWD.

    The variable CDPATH defines the search path for the 
directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.

    If the directory is not found, and the shell option 
`cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.

    Options:
      -L        force symbolic links to be followed: resolve symbolic
                links in DIR after processing instances 
of `..'
      -P        use the physical directory structure without following
                symbolic links: resolve symbolic links in DIR before
                processing instances of `..'
      -e        if the -P option is supplied, and the current working
                directory cannot be determined successfully, exit with
                a non-zero status
      -@        on systems that support it, present a file with extended       
                attributes as a directory containing the file attributes       

    The default is to follow symbolic links, as if `-L' were specified.        
    `..' is processed by removing the immediately previous pathname component  
    back to a slash or the beginning of DIR.

    Exit Status:
    Returns 0 if the directory is changed, and if $PWD is set successfully when

    -P is used; non-zero otherwise.

 

[ 4 ]   폴더를  지우거나  생성하고 싶을 때 

# 내가 빈 폴더를  삭제
rmdir [지울 폴더경로]


# 님이 지우고자  폴더에  권한이 부여되어 있든 아니든 제끼고 지워버림 , 강제로!!!
rmdir -rf [지울 폴더경로]


# 빈 폴더를 생성하고 싶을때

mkdir [폴더명]

 

[ 5 ]  현재  작업 폴더 경로를 위치를 알고 싶을 때 

andan@DESKTOP-LGLU6E9 MINGW64 ~/OneDrive/바탕 화면/sample
$ pwd
/c/Users/andan/OneDrive/바탕 화면/sample

# pwd: 현재 작업 디렉토리의 위치를 알고 싶을 때

 

 

 

 더 추가할 예정