What I learned new this week (week 1)
Before beginning with it I should clearify first why am I writing this. Every day we learn something, specially me because I recently started using Linux for fulltime. So I am learning something every day about it. But I find out that I forget most of it because I do not write it down. So I start writing it down. Also I thought that I should share this with everyone. There might be some information which is new to you. So let’s get started.
Small Disclaimer:- it is not a typical blog post where we deeply discuss about something. Here I will provide only a small brief about lots of thing.
- In Python: To convert a string of date e.g., ‘2024-07-06’ into its corresponding timestamp in milisecond we can use python’s built-in
dateutil
modulesparser
.
from dateutil import parser
datetime_obj = parser.parse('2024-07-06')
print(datetime_obj.timestamp())
-
In Linux: The
PATH
enviroment variable contains all the path of different directories where our system will look of executables. For Example- when we use gcc command to compileC Code
our system goes through each of the paths to find gcc. When it finds the binary for gcc it execute our command to compile theC Code
else we get the error saying gcc is not installed. -
PATH Variable: To add new path to a directory binary and executables in the
PATH
enviroment variable we can use 2 different ways. First one is temporary and second one is permanent.
- To add new path in the PATH Variable temporarily just enter the following command in the terminal.
export PATH=$PATH:/path/to/directory
- To add new path in the PATH Variable permanently we have to follow few steps.
i. Open ~/.bashrc file using vim. -> vim ~/.bashrc
. ZSH users will open .zshrc.
ii. And wite the same commands of temporary addition there. Then Save it.
export PATH=$PATH:/path/to/directory
iii. Reload the shell.
-
In Linux: We can use
echo $0
to print which shell are we using. For shell scripting we can just use$0
. -
In Linux: we can use
lspci
command to get information about pc hardward. Like- name of Audio Device, name of USB Controller. -
In Linux:
lsb_release -a
command will show you a brief info about your os. Like distributor name, release version. -
In Linux:
hostnamectl chassis
will output which type of device you have. Laptop or PC.
That’s it for this week because I still forgot to notedown few things. Meeting you next week.