whoami
: Gives detail about the user login as.
whoami
man
: Tells about the commands.
man <command name>
clear
: Clear the terminal.
clear
pwd
: Tells the location we currently in.
pwd
ls
: List the content of a folder.
ls <file name>
ls -a
: To explore all the files even hidden one's.
ls -l
: To expand and see all the details of the file/folders like dates etc.
ls -al
: To expand and show all the file/folders.
cd
: To move from one to another file.
cd <file name>
mkdir
: Makes a new directory.
mkdir fruit panda
: will make two directories named as fruit and panda.
mkdir -p fruit/panda
: make a nested directory.
rmdir
: remove empty directory.
rmdir fruits cars
: removing mutiple empty directory.
touch
: to make some files.
rm
: to remove files and folders.
rm -v
: tell us what did it do.
rm -r
: to remove directories.
rm -ri
: interactively remove files.
rm -rf fruit car
: delete folders with files in them.
open
: open the directories.
open .
: to open current directory.
mv
: to move directory.
mv open open_pear
: this command can change up file name from pear to open_pear.
mv open stuff
: move from one directory to another.
cp
: Copy files.
cp journel.txt new_jounel.txt
: To make a copy in the same directory.
cp -r <filename>
: to copy a directory.
head
: Outputs the top 10 lines in a file.
head -n 100 file.txt
: To print out the top 100 lines of the file.
tail
: outputs the last 10 lines of a file.
>
: to get the output of a command in a file.
pwd > today.txt
: it saves the output in today.txt file, but this command just replaces the content of the file
Note
: if the file does not exist in the directory, no problem it will create the file and store the output.
>>
: If we use a double right arrow then the content in the file will be updated line by line.
cat
: Concatinate
cat <filename>
: this will print out the contents of the file.
cat <filename1> <filename2>
: concatenate both the files and print out both file's contents.
cat file1 file2 file3 > fileEverything
: It concatenates all the file's content into one file, here that is fileEverting.
less
: Gives an interactive overview of the content saved inside the file.
less file
: Gives an interactive vire of the content and we can search words also.
echo
: Prints the txt file or text that is been provided.
echo hello
: print hello
echo "hello" > anyfilename.txt
: this command puts the hello command in a file called anyfilename.txt, if the file does not exist then it would make a file named after what we mentioned.
wc
: Word Count.
wc -l
: No of lines
wc -w
: No of words
Pipeping
:
ls -l | wc
: This would count the no of lines, words that are been listed by ls -l.
cat file1.txt file2.txt | wc > wordcountfile.txt
: It concatenates the content of file1 and file2 and gives a word count of it and stores the word count to a file name wordcountfile.txt..