CLI Commands
CLI Commands
CTRL+R :
# - allows to search for previous commands as well
REMOVE FILES
rm or Remove
rm ~\text1.txt
rm ~\text1.txt -Force (to force deletion)
rm ~\my_directory_folder -Recurse (delete all inside a directory)
Get-Alias ls
Search on windows via GUI
used Indexin from startup search bar and on Users, advanced option to show contents as
well.
CLI: Select-String cow text.txt or use wildcard: Select-String cow *.txt (Search in all .txt files
for that word).
PIPELINE in Windows
echo woof > dog.txt (create or override the file)
echo woof >> dog.txt (simply add to the existing file but does not override it)
redirection
1: Stdout = 1>
2; Stderr = 2>
Linux
(/ is the root directory in Linux)
ls /
man ls
ls -l (list)
ls -l-a or ls -la – show all files and hidden files as well
mkdir my_cool_folder
backslash (\) in Linux is the escape character, which tells the shell to take the next char as
true value. Another way to do it is: mkdir ‘my cool folder’
COPY COMMAND
cp -r ‘my folder space’ ~/Desktop – needs to use -r(recursive) flag to copy all the folder’s
contents
REMOVE COMMANDS
rm command
rm text1.txt
display files
cat
less (like more on windows) /search
head fruit.txt (10 first lines of a file)
tail fruit.txt (10 last lines of a file)
find in linux
use grep command
redirection
1: Stdout = 1>
2; Stderr = 2>
<
$ cat < file.txt // The redirector is used for stdin.
File Contents Displayed as Input.