Lecture Notes by [email protected]
-
pwd
- present working directorygl
Get-Location
-
cd
- Change to the directory at the given path. Typing ..rather than a path will move up one directory.sl
Set-Location
-
ls
- List the directories and files in the current location.ls, dir
Get-ChildItem
-
cp
- Copies a file to a new location. Takes same arguments as move, but keeps the original file in its location.Copy-Item
-
rm
- Deletes something. Permanently!rm, ri, rmdir, rd, del,
Remove-Item
-
mkdir
- Creates a new item. Used with no parameter, the item is by default a file.New-Item -ItemType Directory -Name 'MyNewFolder'
-
touch
- create a new file or change the timestampNew-Item
- create one or more files -
cat
- Gets the contents of a file and prints it to the screen. Adding the parameter-TotalCount
followed by a number x prints only the first x lines. Adding the parameter-Tail
followed by a number x prints only the final x lines.cat, gc, type,
Get-Contents
-
tail -n7 ./myfile
- display the last 7 lines of myfileGet-Content -Tail 7 ./myfile
-
mv
- Moves something. Takes two arguments - first a filename (i.e. its present path), then a path for its new location (including the name it should have there). By not changing the path, it can be used to rename files.Move-Item
-
man
- manualGet-Help
- Start a Powershell
- In the Taskbar right-click and pin to keep a link there
- Again right click the icon in taskbar and then right-click Windows PowerShell and choose Properties (not on the console, but on the popped-menu in taskbar).
- Enter your preferred directory in the Start in: input field and press OK
- Start from the taskbar icon Done!
In the same Properties Dialog you can also change many other settings like Fonts, Colors, Sizes and on the Shortcut Tab there via button Advanced you can select if that Powershell is to be run with Administrator privileges.
JoyNote: You may set the default path in profile.ps1 as shown here. However,it is not recommended since it may have a conflict with other PowerShell scripts.
One thing I know, I was blind but now I see. John 9:25