TIL: Linux and Shell Commands

김하성·2021년 1월 21일
0
post-thumbnail

Thanks to Mr. Linus Torvald, we have git and linux, which are completely open-source and free!

Linux File Hierarchy

DON'T FORGET - dot file: if there's a dot in front of a file name, then that file is a hidden file (i.e. system setting files, important files that shouldn't be altered or deleted)

Environment Variables

Environment refers to the environment of the shell. There are a bunch of environment variables that are called whenever the shell is running. For example, the PATH variable stores the paths of all environment variable paths. Hence, when you type "ls", the shell searches all of the paths saved in the variable PATH from start to finish and searches for "ls". Once it finds it, the shell runs "ls". The PATH variable is particularly important for when you are downloading and using new packages.

To add a new path...

<file path that you want to add to PATH>:$PATH

Basic Shell Commands

cd /: root directory
cd ~: home directory
pwd: print working directory
env: Operating system variables (시스템 변수)) --> includes path and home (home = /Users/markkimjr/)
ls -a: shows hidden files
.: single dot refers to the current directory
..: two dots refers to the directory right before the current directory (basically goes back a directory in the direction of the root directory)
open: use "open" to list file path and file name to open that specific file
a: stands for "all". reveals all files, even hidden files (ls -a shows all files, even dot files)
cp: copy file --> cp filename desiredirectory
rm: remove rm filename
cat: concatenate files (print the contents of the file) i.e., cat filename.py
chmod: change mode
touch: create a new file and also change date information of a file
mv: move a file/directory

open /home/eun/bin/tesst.py
profile
#mambamentality 🐍

0개의 댓글