In this post i have listed common Linux commands which are very helpful for .Net developer. In most cases asp.net core developers work on Windows. Main reason is that previously .Net was only supported on Windows only, and the most helpful tool, The great IDE, Visual Studio, was only supported on windows.
Now things have changed. .Net Core is cross platform. Available for Windows, Mac and Linux. There is Visual Studio Code, available for all three platforms. However, Visual Studio is still not supported on Linux. But again, .Net core has made easy to develop .net application on Linux machine.
Now, developers who are using Linux for first time, they feel very uncomfortable switching from Windows. And things gets really DARK, when they start working on Linux server, without GUI. Everything need execute commands to perform any task. I have been through that phase. Even today I forget many Linux commands and all I do is repeated search for small Linux commands.
So, I have listed the general day to day Linux commands:
Copy & Move
To copy a file from one location to another, Here is the command:
cp firstfile secondfile
Move command is user for two purpose: Move and Rename.
So this will move first file to other location:
mv /path/to/oldfile /path/to/newfile
And this will rename the file:
mv oldfilename newfilename
The same command is used for move and rename. You can also use it to move and rename it in same command.
Directory Read/Write Permission
On Linux, mostly developer from windows environment face file read and write permission. It’s the case mostly with writing log files, or any file like file upload. In Linux, every user is needed to have permission to read and write file, and the process which runs the application is also act as user, that user is ‘www-data’.
Giving asp.net core (apache www-data user) write permission:
sudo chown -R www-data:www-data /var/www/example.com/public_html sudo chmod -R 770 /var/www/example.com/public_html
This article is in progress, and i will update it with more commands that is used by developer.