Hello Friends, There are chances that you might have started working on the Linux environments after the release of Dot Net Core. In this article I have listed down top 4 beginner Linux commands for every .NET developer.
If you want to start with .net core on Linux platform there is an article for that as well. Though we can user interface to do basic stuff on Linux but with the help of terminal we can complete task much faster.
Terminal is equivalent of command prompt in Windows. The short cut to open terminal is “Ctrl + Alt + T”.
Lets open the terminal using the above command. You can see something like adam@adamubuntu. adam is my user name using which I have logged in to system. And adamubuntu is my machine name or hostname.
Top 10 Linux commands for Beginners
Listing the Folders
‘ls’ can be used to list down all the files and folders in a particular location. This is helpful in orienting yourself or finding where exactly you are in the terminal.
For example if you type ‘ls’ as soon as you open terminal, you can see the contents of the Home directory in terminal.
Creating a Folder in Linux
‘mkdir’ can be used to create a new folder in the terminal in the current location. E.g ‘mkdir MyFolder’ will create a new folder named MyFolder.
You can use ‘cd MyFolder’ to do inside the folder. And to come out of the folder use ‘cd’ only.
Creating a File in Linux
You can use ‘nano’ command to create and edit a text file. For Example, ‘nano Test’ will create a new file named ‘Test’ in the current terminal location. If the file already exists it will open for edit.
Once the file is opened you can edit it. Save it using ‘ctrl + x’ followed by ‘Y’ and ‘enter’.
If you just want to create a file without opening it, you can use ‘touch’ command. E.g. ‘touch myFile’.
Copying folders and files
The command to copy a file or folder is ‘cp’. When you use it, you first indicate a file or folder to copy and then the destination. Let’s move ‘Test’ File into my new Folder ‘Home/TestFolder1’.
First I went to the TestFolder and use the command ‘cp Test ../TestFolder1’. This copies my Test file to ‘TestFolder1’. As you can see in the figure below.
The .. means to go up a directory. And whenever you see a / in a command, you’re dealing with a directory or folder. So if we started in Home/TestFolder1, we’re telling the file to go back up into the Home folder and then into the TestFolder1 one.
I can use copy folders as well using cp command. As you can see in the figure below, I have copied TestFolder to TestFolder1. But to do the same I should not be inside TestFolder. And I should use -R modifier to recusively copy all the contents of TestFolder as well.
Conclusion:
In this article I have discussed some of the commands to start with Linux. These can be very useful for anyone who is moving to Linux environment for .NET core development. I know it can be bit overwhelming in the beginning that’s I have noted down basic commands.
Leave a Reply