Fedora is a user-friendly Linux distribution that makes Windows and Mac users feel right at home with Linux. While Fedora handles the complicated tasks for you and doesn’t require command line intervention (except in rare cases), it is helpful to learn the following commands in case you need them. If you are learning how to program, you will definitely want to learn how to use the command line on Fedora.

Let’s say that you need shell access to a Fedora server to restart it. The ‘ssh’ command can be used to provide shell access as shown below:

ssh username@serverdomain.com

You can just type ‘shutdown -r’ to reboot your Fedora machine. It should return the following:

[username@localhost]$ shutdown -r
Shutdown scheduled for Wed 2018-07-18 17:37:33 EST, use 'shutdown -c' to cancel.

Copying files in Fedora via the command line:

You can copy a file via the command line in Fedora using the short ‘cp’ command. There are many ways to use this command, so be careful, but here is one example of its usage:

cp filename.txt mydir/alternatefilename.txt

This command is convenient because it can also be used to copy a file to its destination with a new filename (‘alternatefilename.txt’ in this case). Be sure to create the destination directory you want to copy the file to, and don’t put a slash behind the destination directory’s name, otherwise you might get a ‘Cannot create regular file’ error.

Installing A Program In Fedora:

You can install a program on Fedora using the following ‘dnf’ command, just make sure it matches the name of the package, as the package name is sometimes formatted a bit differently from the program name (often with a hyphen). For example, run the following commands to install our build tools in preparation for our next activity, which is building programs from source (which is sometimes necessary). It’s great practice!

sudo dnf install autoconf
sudo dnf install automake
sudo dnf install libtool
sudo dnf install gcc-c++
sudo dnf install libdb-cxx-devel

The joys of having to compile programs from source! (I know, it’s tedious)

gcc-c++ is a widely-used C++ compiler which you will most likely need for most builds, so it is worth installing and keeping.

Building Or Launching Programs From Source Code

If you’re a web or software developer and got a new Fedora Linux machine to use at work, you aren’t alone! You might need to build or run a web app for example.

Here is a list of 4 commands commonly used to start web apps. The first one is specific to Node.js.

node app.js
npm start
yarn start

If you need to ‘build from source’ because a particular program isn’t offered with an installer, there is usually a sequence of commands, executed in the following order to carry out the necessary compilation and installation process. Let’s assume it comes from a Git repository. First, find the Git clone url by clocking on the ‘Clone or download’ button on their GitHub page, then clone the repository to download it to your hard drive using the ‘git clone’ command (the git clone URL is highlighted in blue):

git clone https://github.com/litecoin-project/litecoin.git

Git will create a directory with the projects name right in the working directory in which you typed the command. What that means is that if you are in your home directory, it will download the files to that directory under a folder called ‘litecoin’ in this case.

You should see something like this:

Cloning into 'litecoin'...
remote: Counting objects: 115983, done.
remote: Total 115983 (delta 0), reused 0 (delta 0), pack-reused 115983
Receiving objects: 100% (115983/115983), 111.85 MiB | 2.47 MiB/s, done.
Resolving deltas: 100% (80661/80661), done.

Now you can ‘cd’ into the directory (great command to learn, which lets you enter a directory!) with the ‘cd litecoin’ command. Afterwards, type nano INSTALL.md if that file is there (this document is commonly found in Git repositories) to get installation instructions.

Nano is a text editor, which can usually be found on any Linux machine.

In this case, it tells us to go to the doc/build-*.md directory. Just replace the asterisk with the type of OS you have, which is unix in this case:

[nicholas@localhost litecoin]$ nano INSTALL.md
[nicholas@localhost litecoin]$ cd doc
[nicholas@localhost doc]$ ls
assets-attribution.md Doxyfile.in release-notes-litecoin.md
benchmarking.md files.md release-notes.md
bips.md fuzzing.md release-process.md
bitcoin_logo_doxygen.png gitian-building.md REST-interface.md
build-netbsd.md init.md shared-libraries.md
build-openbsd.md litecoin-release-notes tor.md
build-osx.md man translation_process.md
build-unix.md README.md translation_strings_policy.md
build-windows.md README_osx.md travis-ci.md
dependencies.md README_windows.txt zmq.md
developer-notes.md reduce-traffic.md
dnsseed-policy.md release-notes
[nicholas@localhost doc]$ nano build-unix.md
[nicholas@localhost doc]$

‘ls’ is another great command to learn, as it lists directory contents. That file tells us to run the ‘autogen’ and ‘configure’ scripts, and then ‘make’, and ‘make install’. ‘Make’ compiles the code, and ‘make install’ installs the program. ‘Make install’ may require root priviledges, so be prepared to prefix it with ‘sudo’.

It says to type these commands in the following order:

make install

Image credit: REDPIXEL.PL/Bigstock.com