0.Terminal

Terminal

pwd

print working directory

mkdir

make directory

mkdir "I Have Fun":Make a directory with a space in the name by putting quotes around it

mkdir -p??? :建个多层级的目录

Eg.1 mkdir temp
Eg.2 mkdir -p temp/stuff   

cd:change directory

use the .. to move "up" in the tree and path. cd ../..

To get back to your home if you ever get lost. cd ~

ls

list what's in the directory

??? Ls -lR

rmdir

remove directory

If you try to do rmdir on Mac OSX and it refuses to remove the directory even though you are positive it's empty, then there is actually a file in there called .DS_Store. In that case, type rm -rf  instead
(replace  with the directory name).

Pushd

save your current location and go to a new location with pushd "Save where I am, then go here."

push directory

on Unix pushd, if you run it by itself with no arguments, will switch between your current directory and the last one you pushed. 

$ pushd i/like/icecream
~/temp/i/like/icecream ~/temp
$ pushd
~/temp ~/temp/i/like/icecream

Popd

return to the saved location with popd taking you back there.

touch

Make an empty file

cp

copy a file or directory

Eg. cp iamcool.txt neat.txt  <——cope a file(iamcool.txt) to creat a new one(neat.txt)

Eg. cp iamcool.txt something/ <—— cope a file(iamcool.txt) to the directory(something/)

Eg. cp -r something newplace <—— cope a directory to a new one(newplace)

Notice how sometimes I put a / (slash) at the end of a directory? That makes sure the file is really a directory, so if the directory doesn't exist I'll get an error.

The cp command will overwrite files that already exist so be careful copying files around.

mv

move rename a file or directory,rename it!!!

Eg. mv awesome.txt uncool.txt <—— change the name of file awesome.txt to uncool.txt

Eg. mv newplace  oldplace < —— change the name of directory newplace to oldplace

less

page(view) through a file

To get out of less just type q (as in quit)

cat

print the whole file cat the file to the screen.

It's an old command that "con*cat*enates" files together, but mostly it's just an easy way to print a file to the screen. Type man cat to read about it.

rm

remove a file

你可能感兴趣的:(0.Terminal)