1/1/1970
what is sh, the most time command-line??
sh refers to the "Bourne Shell", a command-line interpreter and programming language for Unix-like operating systems.sh command typically refers to the Unix shell and is not directly applicable to the Windows Command Prompt or PowerShell environments.Command Prompt vs Powershell
What is Unix- like shell? common Unix-like shells that are available on Windows 1. Bash (Bourne Again Shell) such as Git Bash:**
Directory Separator
\) as the directory separator.C:\Users\YourName\Documents\myfile.txt/) as the directory separator./home/yourname/documents/myfile.txttouch (Unix-like Shells) : It update the access and modification timestamps of a file. (Creates if doesn't exist)
nul (Window Cmd) : It is a special device in Windows, essentially a "black hole" for output. Anything redirected to nul is discarded.
type (Windows Cmd) : It is used to display the contents of a file.
echo (Unix-like Shells and Windows Cmd) : It is used to display provided arguments (text or variables).
> (Redirection Operator)
Clean Terminal
clear
Remove a file (In Window)
# Remove a file
del path\to\your\file
# Remove a Folder
rmdir /s /q path\to\your\folder
/s: option removes the folder and its contents
/q: suppresses confirmation prompts
Understand type & nul
# Output nothing into a file (Used to Create a empty file or overwrite if exist)
nul > app.js
#or
> app.js
# display content from a file
type app.js
# display and store nothing into a file
type nul > app.js
# display and output content into a file
type Hello world > app.js # Not Valid ❌Display an output type/echo
type app.js
echo app.js ❌ # output string i.e. app.jstype <file> : display the contents of a file in the terminal (Windows Command Prompt).echo <file> : prints the string provided after it to the terminal. in this case print filename, not its contentCreate a empty file or clear a file. >
# Creates a empty file or overwrites
nul > index.html
# or shorthand
> index.html
# unix-based system.
touch index.htmlCreate or overwrite empty file and display file > & type/echo
type nul > app.js
# or
echo > app.jstype nul : It is used to output nothing (nul system null)echo : this by itself outputs a blank lineCreate or overwrite text in a file
# create or clear a file
echo > app.js
# create or overwrite a file with a 'single blank line'
echo. > app.js
# create or overwrite a file with 'Hello World' text
echo Hello world > html.txtCntrl+ Cis used to terminate a running Process in Unix-like Operating System + cmd & shell
REM
REM This is a comment::
:: This is a commentThe echo command in Unix-like operating systems, including Linux and macOS, as well as in the Windows Command Prompt and PowerShell, is used to display a line of text or a string.
echo [option(s)] [string(s)]echo "Hello, World!"note:- like powershell "" is not used in cmd
echo Hello, world! > myfile.txtname="Gaurav"
echo "Hello, $name!"echo -e "Line 1\nLine 2\nLine 3"-e: Enable interpretation of backslash escapes (like \n for newline).-n: Do not output the trailing newline.-E: Disable interpretation of backslash escapes (default behavior).(e.g. require('.\myFile.js'), when it should be .//myFile.js. Remember,