Me Learning Tech

This is where I write about anything that I learn related to any technology.

[Linux] : Command Line Cheat Sheet

There are literally thousands of commands in Linux and I am not even talking about the custom ones developed by the community for some awesome stuff. I accept that it is impossible (at least for me) to remember all of them.Today I came across this awesome “Linux Cheat Sheet” with all the important command-line Linux commands.

But the question is, do we really need so many commands when we are talking to Tux the Penguin? The answer is of course No.

So which are the commands that I really need to know about to become a Linux Ninja? Today I came across this awesome “Linux Cheat Sheet” with all the important command-line Linux commands (courtesy : Linux Training Academy).

View / Download


[JS] : Decimal and Hexadecimal

This is pretty interesting how you can convert not just standard decimal or hexadecimal numbers but any number with base between 2 and 32. Here’s how:

Dec to Hex:

var myDecimalNum = 10;

result : a

Hex to Dec:

var myHexNum = "a";

result : 10

And not just base 16 (hex), you can do it for any base. Try different bases and have fun.

[LINUX] : chmod & chown : The File & Folder Access Control

chmod and chown are among those popular linux commands.

chmod : To modify access to files and folders by providing read/write/execute permissions.
chown : To change the ownership of a file or folder.


There are two ways in which the permissions can be changed/set.

The symbolic method is the one where we mention:

  1. Whose access to change/set (u [user], g [group], o [others], a [all])
  2. What kind of change in permissions (+ [add], [remove], = [set exactly])
  3. Which Permission (r [read], w [write], x [execute])

Example :
To remove read and write permission from group and other of file “myfile.txt”

chmod og-rw myfile.txt

To add execute permission to group of the file “myfile2.txt”

chmod g+x myfile2.txt

The numeric method (my personal favorite) adds up the numbers to determine what kind of permission a file should have:

4 = read
2 = write
1 = execute

Now here’s the magic:

1 = execute (1)
2 = write (2)
3 = write (2) +  execute (1)4 = read (4)
5 = read (4) + execute (1)
6 = read (4) + write (2)
7 = read (4) + write (2) + execute (1)

And the only extra thing to remember is the sequence of permission, it’s always
User -> Group -> Others

To set the permission for a file “myfile2.txt” such as:
a. User has full (read, write and execute) permission … (read+write+execute = 4+2+1 = 7)
b. Group has read and write permission … (read+write = 4+2 = 6)
c. Others have only read permission … (read = 4)

chmod 764 myfile2.txt

Note : 777 is a very dangerous way to give permission, this gives everyone in the world full control over file.


chown is pretty straight forward. Just remember that the syntax used for ownership is owner:group

Here are few examples:

To make a user named bob the owner of folder called MyDirectory:

chown bob MyFolder

To make a group names myGroup the owner of MyDirectory folder (notice the colon before group name, remember the owner:group pattern):

chown :myGroup MyDirectory

To make a user named john and a group named group2 the owner of folder MyDirectory:

chown john:group2 MyDirectory

[LINUX] : useradd & usermod : The Linux User Administration

Adding user to a Linux environment is pretty easy!
Just type useradd followed by username. Example:

useradd anupam

But!! the user cannot login yet, because the password needs to be set.
The password must follow the suggested password rule. To set password, just type passwd followed by username and enter the new password (needs to be executed as root or SU privileges). If you are not a SU then you can only change your password with this command.

You can find the password rules, aging rules etc in the file:


To modify existing user use the command usermod. It has a lot of options like modifying primary group, supplementary group, lock and unlock user account, move or update user home directory etc. Example, to lock user account:

usermod -L anupam

And finally to delete a user, use the command userdel

Pretty interesting eh!

[LINUX] : man, info & pinfo : The Linux Documentations

In Linux, to get help or to read documentations on a particular command we can use either of the three ways : man, info or pinfo .

The help command man is more popular and gives a concise documentation of how to use a command, whereas the info or pinfo are the GNU documentations which are more detailed.

I personally liked pinfo the most, maybe because I come from a windows background, but I guess I will use man more 😀

To get help with any of these documentation commands, just write the documentation command followed with the command with which you need help. Example:

man date


pinfo date


info date

[LINUX] : locale & localectl – The Linux Locale Settings

You can get or set the locale settings in a linux environment (tried in fedora) by using the command :


You can remember it as Locale Control

You can also get more locale information by simply executing the command:


To learn all the possible locale languages type this in terminal:

locale -a

To set locale (to change locale language setting), you can do something like this example:

localectl set-locale LANG=fr_FR.utf8

Also to temporarily to execute any command in a different language, prefix the command with the LANG=<appropriate languagr> <command>. For example:

LANG=fr_FR.utf8 date

To learn more about locale always take help of documentations.

[POWERSHELL] : Get List Of Scheduled Tasks In Properly Formatted CSV

Just when the Powershell Kid thought that CSV is a great way of getting outputs, CSV betrays him.

He realizes this when he tries to create a CSV file which lists all the Scheduled tasks on his computer. He runs this small command which is supposed to get him an output in CSV without any hustle, and it does get him an output in CSV file.

schtasks /query /FO CSV > "C:UsersPKTaskSchedList.csv"

But wait!!. It opens in MS Excel fine, but everything in the file is in a “single” column. This is not how he wanted it. Well, of course, it has a way around, by doing some MS Excel Mumbo Jumbo, but he doesn’t like this way of doing it. So he tries this new hack. Powershell does have its ways to get things done.

#Save this as a file named "TaskSchedList.ps1"

$Scriptpath = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
$tempfile = "$($env:temp)TempTaskSchedList.csv"
$outputFile = "$ScriptpathTaskSchedList.csv"
schtasks /query /FO CSV > $tempfile
Import-csv -Path $tempfile | ?{$_.Taskname -notmatch "TaskName"} | Export-csv -Path $outputFile -NoTypeInformation

And great!! It does wonders!

[POWERSHELL] : Get Path Of Currently Executing Script

Another interesting scripting day for Powershell Kid and suddenly he is stuck at a simple problem. He can’t keep mentioning the full directory path every time explicitly in the script. Because, next minute if he moves the script to some other location, the script fails!! Let’s look into the problem he is facing.

Powershell Kid creates an awesome script which uses few other files for input and output. So his script is saved at

D:My Test ScriptsThe Crazy ScriptCrazyPS.ps1

and the script uses external files for input and output purpose, something like

$inputcontent = Get-Content "D:My Test ScriptsThe Crazy Scriptbininput.txt"
$output >>  "D:My Test ScriptsThe Crazy Scriptbinoutput.txt"

Continue reading “[POWERSHELL] : Get Path Of Currently Executing Script”

[POWERSHELL] : Get-PrinterDetails from Print Servers




In your server environments sometimes to get the details of printers on a print server people need to log-in to the print server, open MMC console, go to print management, add servers and then get to see the printer details.

This is a Powershell script which is invoked by the batch file in the main folder does that all for you. Running the batch file would give a prompt asking for server name and credentials for the server.

The output produced is a HTML file which opens right after the execution completes. Continue reading “[POWERSHELL] : Get-PrinterDetails from Print Servers”

Powered by

Up ↑