If you want to be a better programmer, you should learn terminal commands. If you are a Windows user, then you should learn the CMD command to create and edit files and folders.
Open the Windows command prompt and use the following command to create and navigate the folder. You can also add and run these commands inside a .bat file (for automation purposes)
To create a folder: mkdir folder_name (or Folder_name with location)
Example : mkdir D:\python books
To Navigate to that folder
cd D:\python books
Note: ‘cd' means change directory.
If CMD won't change the directory to another drive, use /d after the cd.
cd /d D:\files
You can also use the drive letter with a semicolon to change the drive
C:\> d:
To Navigate back to the Previous Directory
cd ..
To rename the folder
ren D:\python books python learning material
To list the files in the current directory
dir
Note: Use dir /? To get the build-in help documentation, to learn more about the dir command to sort fields with size, name, etc.
Move files from one location to another.
move hello.txt D:\
To move multiple files with the same file extension
Use a wildcard to specify the file pattern if you want to move multiple files.
move *.txt C:\Users\public\Desktop
Note: It will not overwrite files if they are already in the destination folder.
If you want to overwrite an existing file, then use the following command: Also, use (move /?) to get additional information and options.
move /Y *.txt C:\Users\public\Desktop
To copy Files: copy (source) (destination)
Ex: copy hello.txt D:\
To copy all files inside the folder: xcopy (source) (destination) /E /I /H
Ex: xcopy D:\rani C:\Users\Public\Desktop /E /I /H
Note:-
To create text files: Use the echo command to create text files.
echo (text) > (file name with extension)
Example : echo Hello world >mytext.txt
It will create a file named mytext.txt with the content “hello world” in the current directory.
To read a text file content
You can also use the following command to create files with other extensions, like .py or .md
notepad test.py
If you want to use the “touch” command to create files (like the videos you see on YouTube), install the npm package named touch-cli using the following command:
npm install touch-cli -g
Then try to create the file using the following command:
touch test.html
Use the type command to open and read a text file: type (filename with extension)
type mytext.txt
To change the content inside a text file
Use the echo command followed by ‘>” (redirection operator to overwrite text file content.
echo Good Morning>mytext.txt
You can also use the copy con command followed by the file name to edit the text file content.
copy con mytext.txt
Edit the content you need. Then press Ctrl + Z and press the Enter key to save the changes.
To delete a file
del mytext.txt
To delete a folder or directory (use the command be carefully. Because it will delete the folder without your confirmation)
rmdir /s /q folder_name
Or use the command with rd instead of rmdir
rd /s /q folder_name
Note: use rmdir or rd with the /s option to delete the folder.
How to start the specific application
Use the start command followed by the name or path of the file.
start chrome
or
start C:\Program Files\Google\Chrome\Application\chrome.exe
To clear previously typed commands & output on the command panel
cls
To Close the command prompt
Type exit and press Enter.
exit
When you see professional software developers, they write code very fast, even if you can't understand what keys they are using. If you want to be a good programmer, you should avoid using a mouse and you have to learn lots and lots of keyboard shortcut keys to work very fast and save so much time.
But the shortcut keys are different for each OS, like Windows and Mac, and for each application, like VS Code, Photoshop, or After Effects.
In this tutorial, I list the best Windows shortcut keys for a programmer. If you want to learn Windows CMD commands, you can learn that from my other blog post.
To Open the Right-click menu for a File or Folder -> Shift + F10
Permanently delete the file (Delete the file without ending to Recycle Bin) -Shift + Delete
Insert the link: Select the text and press Ctrl + K keys together (in content editors like WordPress or Gmail Reply) to insert the link.
To select text from the cursor: Use Shift +Up Arrow. You can also use the Home button to move the cursor at the beginning of the sentence. When pressing the Shift key, use the Up and Down arrows to select multiple lines of text.
I keep updating this article as much as possible. Every day I am working on coding, I find some new tricks and methods to create applications much faster.
© 2024 Webapptiv. All rights reserved.