Found 975 Articles for Software & Coding

How to create an Animated Art on Your Linux Terminal?

Pradeep Elance
Updated on 25-Feb-2020 06:17:05

4K+ Views

Using the characters like - , / or | and many other from the keyboard, we can create animation characters. These characters can be static as well as moving in the screen. All this involves programming using shell scripting. These scripts are bundled into libraries or packages which can be installed in the terminal. Below we will see the examples of these animations.A Running TrainThis package produces a train animation when run from the terminal. But first we install it and then simple type sl in the terminal.$ sudo apt-get install sl $ slRunning the above code gives us the ... Read More

How to Change or Set System Locales in Linux

Pradeep Elance
Updated on 25-Feb-2020 06:00:00

3K+ Views

We often need to customise the operating system to become useful to our own preferences like the language we want to use the time zone we are in the type of currency which would become the default currency in the OS etc. In this article we will see how to customise these options which is known as locale.Current localeWe can check the current locally by using the locale command as shown below. We get list of variables which can be reset to a different value as per our choice later$ localeRunning the above code gives us the following result −LANG=en_US.UTF-8 ... Read More

How to create an array in PowerShell?

Chirag Nagrekar
Updated on 14-Feb-2020 06:41:14

2K+ Views

To create or declare an array in PowerShell, there are few methods.You can directly assign values to the variable and separate it by comma (, ) and that variable becomes the variable.For example, $a = "Apple", "Dog", "Cat", "Banana", "Camel"$a is now an array. To access the variable you can use the Indexing method. The first value will be stored at 0, second at 1 and so on.$a[0] will give the output “Apple”, $a[1] will give the output “Dog” and so on. Negative indexing also works in the array. -1 is the last index, -2 is the second last and ... Read More

What is Array in PowerShell?

Chirag Nagrekar
Updated on 14-Feb-2020 06:40:16

344 Views

An array is consists of a set of elements of the same data types or the different data types. When the output consists of more than one line then output or stored variable automatically becomes the Array. Its data type is Object[] or ArrayList and base type would be System.array or System.Object.For example, The output of IPConfig is an array.ExamplePS C:\WINDOWS\system32> ipconfig Windows IP Configuration Ethernet adapter Ethernet: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Ethernet adapter VirtualBox Host-Only Network: Connection-specific DNS Suffix . : Link-local ... Read More

How to overwrite or remove PowerShell alias?

Chirag Nagrekar
Updated on 14-Feb-2020 07:58:30

5K+ Views

You can overwrite the Powershell alias by redefining it. For example, if the alias is created Edit for Notepad.exe and if you want to overwrite it with another program, say wordpad.exe then use the below command.We will overwrite the Edit alias cmdlet with Wordpad.exe using the Set-Alias command. When you close the PowerShell session, it will remove newly created aliases and modified aliases.Set-Alias edit "C:\Program Files\Windows NT\Accessories\wordpad.exe"You cannot overwrite pre-defined aliases. It will throw an exception.For example, when you try to modify dir alias which points to Get-Content, error output will be as below.To remove newly created aliases without closing ... Read More

How to create PowerShell alias permanently?

Chirag Nagrekar
Updated on 14-Feb-2020 08:07:54

4K+ Views

PowerShell alias can be created permanently by 2 methods below.a) Import / Export AliasTo export all the aliases, you need to use Export-Alias cmdlet. When you use this command it will ask you the path for the file to import.To export the newly created alias, you need to give alias name and the name for the export, so later you can import it with the same name.In the below example, we have created alias name Edit for the Wordpad and we will export all the aliases with the name Alias1, so the newly created alias will also be stored and ... Read More

How to create new alias with PowerShell?

Chirag Nagrekar
Updated on 14-Feb-2020 08:06:31

575 Views

Anyone can create a new alias which is a shortcut to another command. To create your own alias you need to use Set-Alias cmdlet. Here, we will create a new alias Edit, which will open a Notepad.exe. First, we will check if Edit alias exists or not.$Alias:EditAs this is going to be a new Alias there will be no output for it. Now, we will create new alias by the below command. You can provide any program path and create an alias for it.Set-Alias Edit Notepad.exeJust check if this Edit alias created successfully or not.PS E:\scripts\Powershell> $Alias:Edit Notepad.exeThis new alias ... Read More

How to get all the aliases in PowerShell?

Chirag Nagrekar
Updated on 14-Feb-2020 08:05:45

399 Views

In PowerShell, you will get all the alias and their commands using Alias: drive as shown below.Dir Alias:OutputHere, Alias: is the drive but surprisingly you will not find it in your operating system. This is the virtual drive and there are other virtual drives as well. You can list all the virtual drives using the below command.Get-Alias will provide the same result.The above output provides the individual alias and their commands for it. But to group them based on their cmdlets, you need to use Group-Object command.Dir Alias: | Group-Object DefinitionOutputYou will see in the output that aliases are listed ... Read More

How to get/resolve the command from the alias in PowerShell?

Chirag Nagrekar
Updated on 14-Feb-2020 08:03:32

381 Views

To resolve the command name from given alias, you need to use the below command.$Alias:AliasNameFor example, $Alias:dirOR$Alias:lsOutputGet-ChildItemThis means the above commands will provide the same result. For example, the output of the below commands would remain the same.Get-ChildItem C:\ Dir C:\ ls COutputYou can also use Get-Alias to resolve the alias name. For example, Get-Alias -Name dirGet-Alias -Name lsUntil now we need to remember alias name to get the command and we were running individual commands to get the Alias and its command. It is possible to get all the alias names for the given command. To get all aliases ... Read More

What is an alias in PowerShell?

Chirag Nagrekar
Updated on 14-Feb-2020 08:02:55

249 Views

In general, Alias means giving command to other names. In system admin life, they want short and familiar commands. PowerShell has verb-noun cmdlets that are very systematic but not practical in everyday life. So the System admins use PowerShell alias. For example - Dir or ls for the Get-ChildItem, cat or gc for the Get-Content.

Advertisements