10 ways to code with linux
Coding in
Linux mostly happens in the Terminal or the Command Line. While it can be a
scary looking place to begin with, the Terminal is an extremely powerful environment.
Before you can start to code, it’s best to master the Terminal.
Taking Command
The
command line is at the core of Linux and when you program with it, this is
called scripting. These are self-contained programs
designed to be run in the Terminal.
Step
1
The
Terminal is where you begin your journey with
Linux, through the command line and thus
any
scripting from. In Linux Mint, it can be accessed by clicking on the
Menu followed by the Terminal icon in the panel, or entering ‘Terminal’
into the search bar.
Step 2
The
Terminal will give you access to the Linux Mint
Shell, called BASH; this gives you access to the
underlying operating system, which is why scripting is such a powerful
language to learn and use. Everything in Mint, and Linux as
a whole, including the desktop and GUI, is a module running from the
command line.
Step 3
What
you currently see in the Terminal is your login name
followed by the name of the computer, as you named
it when you first installed the OS on to the computer. The line
then ends with the current folder name; at first this is just a tilde (~),
which means your Home folder.
Step 4
he
flashing cursor at the very end of the line is where
your text-based commands will be entered. You
can begin to experiment with a simple command, Print Working Directory
(pwd), which will output to the screen the current folder you’re
in. Type: pwd and press Enter.
Step 5
All
the commands you enter will work in the same manner.
You enter the command, include any
parameters
to extend the use of the command and press Enter to execute
the command line you’ve entered. Now type: uname -a and
press Enter. This will display information regarding Linux Mint. In
scripting, you can use all the Linux command-line commands within
your own scripts.
Step 6
The
list of available Linux commands is vast, with
some simply returning the current working directory,
while others are capable of deleting the entire system in an
instant. Getting to know the commands is part of
learning how to script. By using the wrong command, you could end
up wiping your computer. Type command to view the available
commands.
Here Be Dragons!
There’s
an urban myth on the Internet that an employee at Disney Pixar nearly ruined
the animated movie Toy Story by inadvertently
entering the wrong Linux command and deleting the entire system the film was
stored on.
Step
1
Having
access to the Terminal means you’re bypassing
the GUI desktop method of working with
the system. The Terminal is a far more powerful environment than
the desktop, which has several safeguards in place in case you accidentally
delete all your work, such as Rubbish Bin to recover deleted
files.
Step 2
However,
the Terminal doesn’t offer that luxury. If you
were to access a folder with files within via the Terminal
and then enter the command: rm *.*, all the files in that folder
would be instantly deleted. They won’t appear in the Rubbish Bin
either, they’re gone for good.
Step 3
Therefore
it’s always a good idea to work in the Terminal
using a two-pronged approach. First, use the
desktop to make regular backups of the folders you’re working in
when in the Terminal. This way, should anything go wrong, there’s a
quick and handy backup waiting for you.
Step 4
Second,
research before blindly entering a command
you’ve seen on the Internet. If you see the
command:
sudo dd if=/dev/random of=/dev/sda and
use it
in a script, you’ll soon come to regret the action as the command will
wipe the entire hard drive and fill it with random data. Take a moment
to Google the command and see what it does.
0 Response to "10 ways to code with linux"
Post a Comment