In this part, we will see some basic Unix commands. As we will use git most of the time in command lines, it would be good to learn some basic Unix commands. Make sure you are using git bash for running these commands, Otherwise in the windows operating system some commands might not work.
ls is short for the list of contents in the current directory including files and folders. If we want to see the list inside a folder we can use ls with a path like this
This will show the contents inside the folderName directory. To see the dotfiles or hidden files folders you can pass the -a flag like this
This command will show the hidden files and directories
This will show the present working directory.
This command is used for changing the directory. To go to a directory you have to write the path after cd like this
You can move or go to multiple directories by typing the path like this
If you want to change the directory backward you have to type
You can go back to multiple directories. Like if you go back two-step you have to type like this
This will make you go back to two directories you can add more step like this ../
start . or open .
To open a directory in file explorer in the windows operating system you have to write
And to open a folder in MAC you have to write the following command
To create a file you can use the touch command followed by the file name with an extension like
You can create multiple files in a single touch command by putting space between the files name like
touch index.html style.css script.js
This command will create all the files mentioned above
You can create a file inside another folder by typing the path like this
This command will create a test.txt file inside the folderOne directory.
mkdir is used to create a directory. like
If your folder name contains spaces this command will create separate directories instead of creating one directory. Like
mkdir my new directory
this command will create three folders named my, new, directory instead of creating one folder
If you want to create a directory or folder name with spaces you have to use quotation like this
mkdir "my new directory"
This command will create a single folder named my new directory.
To delete a file you can use rm command. This command will delete your file permanently and will not store in recycle bin or trash. Like
You can also delete the file from the directory by referencing the path like if I have a file named testFile.txt inside testFolder I can delete this like
This command will delete the testFile.txt inside the testFolder.
You can delete multiple files at a time by typing their name separating with space like
rm fileOne.php fileAnother.html
rm -rf or rmdir
To remove a directory you can pass the -rf flag or you can use rmdir command. Like to delete folder name test the command is
rm -rf test
If you missed the first part of this tutorial you can read it from here https://devunlock.com/content/git-tutorial