Python
https://learnpythonthehardway.org/book/
One Appendix A: Command Line Crash Course
1. https://learnpythonthehardway.org/book/appendix-a-cli/ex5.html
*Find out how to cd to your "home directory" with one command. cd ~
*Remember when you put quotes around a directory with spaces in it? You can do that with any command. For example, if you have a directory I Have Fun, then you can do: cd "I Have Fun"
? But I don't know why it did not work when I tried to change to "My Music/My Pictures/My Videos", while it did work for "My Documents/Saved Games".
2. https://learnpythonthehardway.org/book/appendix-a-cli/ex6.html
On Windows do the same thing with dir -R.
3. https://learnpythonthehardway.org/book/appendix-a-cli/ex7.html
In this example you'll learn how to remove a directory. It's easy. You just go to the directory right above it, then type rmdir <dir>, replacing <dir> with the name of the directory to remove.
4. https://learnpythonthehardway.org/book/appendix-a-cli/ex8.html
These commands let you temporarily go to a different directory and then come back, easily switching between the two.
The pushd command takes your current directory and "pushes" it into a list for later, then it changes to another directory. It's like saying, "Save where I am, then go here."
The popd command takes the last directory you pushed and "pops" it off, taking you back there.
5. https://learnpythonthehardway.org/book/appendix-a-cli/ex10.html
Use the cp -r command to copy more directories with files in them.
I tried, cp did not work, it can cope the file only, not including the contents.
Copy a file to your home directory or desktop.
If you would like change the path, just add the path before the file name
For example: PS c:\users\jessie.dai\temp > cp -r something D:\newtry
It means copy the something file in Disc C to Disc D and change the name to newtry
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.
6. https://learnpythonthehardway.org/book/appendix-a-cli/ex11.html
Moving files or, rather, renaming them. It's easy: give the old name and the new name.
7. https://learnpythonthehardway.org/book/appendix-a-cli/ex12.html
Now do the exercise again, but this time page through it. On Unix you use the spacebar and w (the letter w) to go down and up. Arrow keys also work. On Windows just hit the spacebar to page through.
The cp command will overwrite files that already exist so be careful copying files around.
Then you cat the file to the screen. This command just spews the whole file to the screen with no paging or stopping. To demonstrate that, I have you do this to the test.txt which should just spew a bunch of lines from that exercise.
Windows: Try cat test.txt,test2.txt and see what it does.
8. https://learnpythonthehardway.org/book/appendix-a-cli/ex14.html
rm/rmdir like the same for files or folders
rm -r/rmdir -r the same for files or folders
Remember when I had you try to rmdir on a directory with something in it? Well, that failed because you can't remove a directory with files in it. To do that you have to remove the file, or recursively delete all of its contents. That's what you did at the end of this.
Write in your notebook to be careful when running recursive remove on files.
Windows
If you're using Windows then here's your list of commands:
pwd print working directory
hostname my computer's network name
mkdir make directory
cd change directory
ls list directory
rmdir remove directory
pushd push directory
popd pop directory
cp copy a file or directory
robocopy robust copy
mv move a file or directory
more page through a file
type print the whole file
forfiles run a command on lots of files
dir -r find files
select-string find things inside files
help read a manual page
helpctr find what man page is appropriate
echo print some arguments
set export/set a new environment variable
exit exit the shell
runas DANGER! become super user root DANGER!
For Windows look up these things:
forfiles
runas
attrib
icacls
https://python.swaroopch.com/
http://www.pstips.net/powershell-online-tutorials/
http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000
One Appendix A: Command Line Crash Course
1. https://learnpythonthehardway.org/book/appendix-a-cli/ex5.html
*Find out how to cd to your "home directory" with one command. cd ~
*Remember when you put quotes around a directory with spaces in it? You can do that with any command. For example, if you have a directory I Have Fun, then you can do: cd "I Have Fun"
? But I don't know why it did not work when I tried to change to "My Music/My Pictures/My Videos", while it did work for "My Documents/Saved Games".
2. https://learnpythonthehardway.org/book/appendix-a-cli/ex6.html
On Windows do the same thing with dir -R.
3. https://learnpythonthehardway.org/book/appendix-a-cli/ex7.html
In this example you'll learn how to remove a directory. It's easy. You just go to the directory right above it, then type rmdir <dir>, replacing <dir> with the name of the directory to remove.
4. https://learnpythonthehardway.org/book/appendix-a-cli/ex8.html
These commands let you temporarily go to a different directory and then come back, easily switching between the two.
The pushd command takes your current directory and "pushes" it into a list for later, then it changes to another directory. It's like saying, "Save where I am, then go here."
The popd command takes the last directory you pushed and "pops" it off, taking you back there.
5. https://learnpythonthehardway.org/book/appendix-a-cli/ex10.html
Use the cp -r command to copy more directories with files in them.
I tried, cp did not work, it can cope the file only, not including the contents.
Copy a file to your home directory or desktop.
If you would like change the path, just add the path before the file name
For example: PS c:\users\jessie.dai\temp > cp -r something D:\newtry
It means copy the something file in Disc C to Disc D and change the name to newtry
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.
6. https://learnpythonthehardway.org/book/appendix-a-cli/ex11.html
Moving files or, rather, renaming them. It's easy: give the old name and the new name.
7. https://learnpythonthehardway.org/book/appendix-a-cli/ex12.html
Now do the exercise again, but this time page through it. On Unix you use the spacebar and w (the letter w) to go down and up. Arrow keys also work. On Windows just hit the spacebar to page through.
The cp command will overwrite files that already exist so be careful copying files around.
Then you cat the file to the screen. This command just spews the whole file to the screen with no paging or stopping. To demonstrate that, I have you do this to the test.txt which should just spew a bunch of lines from that exercise.
Windows: Try cat test.txt,test2.txt and see what it does.
8. https://learnpythonthehardway.org/book/appendix-a-cli/ex14.html
rm/rmdir like the same for files or folders
rm -r/rmdir -r the same for files or folders
Remember when I had you try to rmdir on a directory with something in it? Well, that failed because you can't remove a directory with files in it. To do that you have to remove the file, or recursively delete all of its contents. That's what you did at the end of this.
Write in your notebook to be careful when running recursive remove on files.
Windows
If you're using Windows then here's your list of commands:
pwd print working directory
hostname my computer's network name
mkdir make directory
cd change directory
ls list directory
rmdir remove directory
pushd push directory
popd pop directory
cp copy a file or directory
robocopy robust copy
mv move a file or directory
more page through a file
type print the whole file
forfiles run a command on lots of files
dir -r find files
select-string find things inside files
help read a manual page
helpctr find what man page is appropriate
echo print some arguments
set export/set a new environment variable
exit exit the shell
runas DANGER! become super user root DANGER!
For Windows look up these things:
forfiles
runas
attrib
icacls
https://python.swaroopch.com/
http://www.pstips.net/powershell-online-tutorials/
http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000
还没人赞这篇日记