January 24th, 2021
Hello everyone today I'll try to explain some very basic Unix commands together, since they are not as tricky as others before I thought maybe it's best to merge some of them into a single one. I hope you enjoy reading it.
I'll provide some visuals over our older guide about find and then I'll explain which command does what in which step.
First we start with ls, ls is the listing command that can take many arguments to show different results.
Without using any other flags ls will list the files and directories that we usually expect to see.
If we add -a flag it'll list all files and directories including the normally invisible ones, for example in our case single and double dot directories. The single stands for our current directory while the double dot stands for the parent directory.
If we add -l flag ls command performs a long listing instead. It'll respectively show us the permissions, user, group, size, date and the name of the listed item.
Here I'll explain 2 seperate commands together the cd and the pwd. The pwd command shows us the current working directory and the cp command allows us to the current directory. I'll perform pwd command between each cd so you can follow along.
We first take a look at where we are, then we go to "folder1" directory since that's a relative path it wouldn't work if we didn't have it in our folder. When we go to double dot directory we returned back to our parent directory and when we go to single dot directory we stay at the same place instead. If we don't provide any arguments we'll go to home directory, we can then use some of the absolute paths to go back to our find folder.
Now we go to another directory to perform some file manipulations.
When we check our structure we can see the we have 3 directories with some files in them. I'll show the results with tree command between each execution of others.
When we run rm command on a file, it'll automatically remove the aimed file as in the example.
When we run mv with to arguments it'll move the file from argument 1 to the directory at argument 2.
When we run cp command instead it'll copy the argument 1 to the directory at argument2
We can create files with touch command we can also delete them afterwards with rm command as its shown above.
With mkdir and rmdir we can create and remove directories, I believe the example above is quite explanatory about the usage of the commands.
Alright everyone, today's tutorial was a fairly short one compare to others. If you want to learn more about the each command you can search them here to check their manuels or you can simply run man command with the desired manuel as argument on your terminal.
I hope to see you in the next one, take care :)