Using nano in Gentoo

Can someone please explain what this command does ( echo “gui-libs/display-manager-init-1.0” >> /etc/portage/.accept_keywords/.accept_keywords ) Will this write gui-libs/display-manager-init-1.0 and
make a dir and a file called .accept_keywords in the portage dir? If I can get by this then I can get
Gentoo running in a VM.

It will append the line of text to the file which is accessible in the file path provided after the >>. If the directory exists, but the file does not, this will be created. If the directory does not exist, it will not be created.

OK, the .accept_keywords does exist, and this will append or copy gui-libs/display-manager-init into
a file called .accept_keywords? What changes if I use one > and two >>? Why is the command " echo "
being used? I am having to relearn the echo command. What is the " touch " command?

1 Like

The echo command will print a certain string to STDOUT. It is especially useful in combination with variables or if you plan to write something into a file.

foo > bar writes the output of the command foo into the file with the name bar. If the file exists, its previous content will be overwritten (deleted).

foo >> bar appends the output of the command foo to the end of the file with the name bar. If the file doesn’t exist, it will be created.

Are you sure, you want to venture into Gentoo with only limited knowledge of basic shell syntax? It might turn out to be a frustrating experience.


@Akito …OK, I will bookmark this for future reading. This is also why I am using the Gentoo Handbook, the only
trouble is, that it may give a bash script, without any explanation.

@Mina …Thanks for the explanation, and yes I do!!! Will never learn until I try. I have Gentoo with XFCE
running in a VirtualBox VM, just trying to make sense of all the commands.

Very well.

For starters, I would especially recommend the sections about “input/output redirection” (pipes) and the cat command.


@mina…A lot of things makes sense now!! So explain the use of ( ‘.’ ) that is sometimes entered into a command and also what is the difference between using ( ) to using { } to enclose certain parts of the command? Thank you.

Please read the guide I linked you earlier and you can also search for further guides, if that one was not enough. There is no point in explaining every little detail, one by one…

As @Akito already pointed out, this is hardly the place to guide you through your learning process.

However, I do think, your apprach of seeking advice when questions arise is actually a good way of learning, probably better than trying to digest entire manuals with too much information at once, just not in an online forum. If you happen to be an academic environment or to work in an IT-related industry, it might be a good idea to approach one of the people around you and ask her to sit down with you for an afternoon or two for some cuppers in front of the screen.

For now: . stands for the current work directory, .. for the directory above. Note that under all operating system, in order to execute a command, the command has to reside in a directory contained in the $PATH variable or it has to be called with its full path. In Windows, the current work directory is always added to $PATH, in unixoid operating system, it’s not, so you have to specify the full path. This can be done by using the short circuits ., .. or ~ (your home directory).

Parenthesis ( list of commands ) execute commands in a subshell. After the execution of these commands, your shell variables aren’t changed, even if you assigned them values inside. This is an advanced topic - read the manual or talk to someone real.

Regarding braces { ... }, please read this:

1 Like