Eren Akbulut's Blog

Unix Commands VII - Basic Commands II

January 30th, 2021

Hello everyone, today I'll briefly explain some more basic Unix commands, it'll be a fairly short one and with much lesser details. So if you are ready let's start with the first one.


Tar

The first one we'll talk about today is tar, with tar you can archive and unarchive directories.

unix-basic2-tar

Here we create a directory called filetozip(maybe I should've named it filetotar but you got the point), and then we compress and uncompress that file via using tar, since compress is also a command in Unix you can say tar and untar instead.

Additional Information


Gzip

Gzip is being used for similar reasons but instead it work on files for compressing purposes, the use of it also fairly simple.

unix-basic2-zip

As you can see here we create a file called "filetogzipped" first we gzip and gunzip it just by giving the target as the first parameter.

Additional Information


whoami

It's quite simple, prints the name of the user who ran the command.

unix-basic-whoami

who

Unlike whoami, who prints the all the currently logged in users, for example below here I have 2 terminals opened with 2 users and I get both of them with the terminals they opened.

unix-basic2-who1

If I close one of them instead I'll see something like that one.

unix-basic2-who2

date

Sometimes when you connect to a remote server over ssh knowing the current system date can be so important to see that you can simply run that command and the system date is at your service.

unix-basic2-date

history

Sometimes you may want to see your commands history for obvious reasons, in such a case all you need to do is to run "history". You'll end up with something like below you can go up and down via arrow keys and you can escape via pressing the key "q".

unix-basic2-history

Bonus: fortune

The fortune is a really fun command and a pretty old one, it can give random funny texts to you as an output, if you want you can pipe it to some other command to save, but seriously, why would you? :)

unix-basic2-fortune

Alright everyone, that's it for today, since I started to give basic commands in multiple section I'll write 1 more after that and I'll finish it, yet now it feels like they all can be better together so I'll merge them all together after I finish the series.

I hope to see you in the next one, take care :)

This blog has been created by Eren Akbulut 2020