前端常用的Linux命令

Here is a list of some common Linux commands for front-end developers :))

pwd

current directory

mkdir {{name_of_your_directory}}

create a directory

cd {{relative_path_of_new_directory}}

change directory

# cd ./my-app let's say the current directory contains a my-app directory, this is for going into the my-app directory

# cd .. move from your current directory to a directory one level up

# cd / navigate to the root directory from anywhere

# cd ~ navigate to the home directory from anywhere,

ls

list all files in current directory

# ls -a list all files in current directory including hidden files

# ls -h list all files in current directory in a human readable format

touch {{name_of_file}}

create a new file

mv {{name_of_file}} {{relative_path_of_new_location}}

move a file

mv {{name_of_file}} {{name_of_new_file}}

rename a file

cp {{name_of_file}} {{relative_path_of_new_location}}

copy a file

cp -r {{name_of_directory}} {{relative_path_of_new_location}}

copy a directory

rm {{name_of_file}}

delete a file

rm -r {{name_of_directory}}

delete a directory

more {{name_of_file}}

read the whole file content

grep {{text_to_search}} {{name_of_file}}

search text inside a file

kill {{pid}}

kill a process with a specific id

lsof

find out which files are opened by which Linux process

# lsof -i tcp: -t list the pid running on a specific port