What is options linux

What is $OPTIONS in a systemd service file?

I’m not sure where $OPTIONS comes from. It looks like an environment variable, although when I set a shell variable that way it is ignored, e.g.

# OPTIONS='-p 9999' # systemctl start sshd 

I read through the command lines portion of the systemd.service man page, which indicates that environment variables can be set via an Environment line:

Environment="ONE=one" 'TWO=two two' 
EnvironmentFile=-/etc/sysconfig/sshd 

@MichaelD. Systemd would be pretty broken if it didn’t start services in a clean environment. invoke-rc.d and service commands have always cleaned the environments, systemd is no different.

1 Answer 1

The unit file in Debian is similar, containing:

[Service] EnvironmentFile=-/etc/default/ssh ExecStart=/usr/sbin/sshd -D $SSHD_OPTS ExecReload=/bin/kill -HUP $MAINPID 

Here, the EnvironmentFile assigns SSHD_OPTS :

# Options to pass to sshd SSHD_OPTS= 

It’s likely that Fedora uses a similar system, but for some reason they just haven’t explicitly set the variable. That shouldn’t matter, it should expand to an empty string.

There’s a mention here that e.g. httpd.service uses OPTIONS similarly, and sets it in /etc/sysconfig/httpd . So it’s likely just unset for some reason.

You could check sshd ‘s command line with ps to see what the variable is expanded to, and also set it to something in the sysconfig file to check that it works if set there.

As for setting the environment variable on the shell command line, AFAIU systemd doesn’t run the services in the environment of the shell calling systemctl , but forks them off the main systemd process. That way they don’t inherit settings of the shell environment even accidentally. Environment variables can have a wide range of effects and it would be annoying to have your services act differently depending on if they are started at system boot or restarted from the command line.

Источник

A guide to the Linux terminal for beginners

Learn the differences between Linux terminal commands, arguments, and options, and how to use them to control your computer.

Terminal command prompt on orange background

There’s a café a few streets away from where I live, and I go there every Sunday for a regularly scheduled game of D&D. They have a menu, and the first few times I ordered, I looked over the menu for several minutes to see what my choices were. Being a creature of habit, I eventually stopped referring to the menu because I knew exactly what they have for sale, and I know exactly what I want. Ordering food for the table is now as easy as saying «the usual» and waiting for the cups of coffee and bowls of chips and scones to be delivered (usually inconveniently at just the moment we’ve rolled for initiative, but that’s hardly the staff’s fault or problem).

Читайте также:  Зарезервированные имена файлов linux

Similar to a restaurant menu, graphical interfaces for computers offer users a choice of actions. There are icons and windows and buttons, and you hunt for the one you’re looking for, click on items, drag other items, and manipulate graphical representations until a task is complete. After a while, though, this can become cumbersome and, worse yet, inefficient. You know exactly what needs to be done, so wouldn’t it be nice to just tell the computer exactly what you want to happen, rather than going through the physical and mental motions of hunting for components and repeating a mouse-based dance routine?

What is the Linux terminal?

The Linux terminal is a text-based interface used to control a Linux computer. It’s just one of the many tools provided to Linux users for accomplishing any given task, but it’s widely considered the most efficient method available. Outside of writing code, it’s certainly the most direct method possible. It’s so popular, in fact, that Apple changed its foundation to Unix and has gained the Bash and Z shell, and Microsoft developed PowerShell, its very own open source command line.

What is a Linux command?

A command is a special keyword you can use in a terminal to tell your computer to perform an action. Most commands are tiny little applications that get installed with the rest of your operating system. You may not realize they’re on your computer because they’re generally kept in relatively obscure directories like /bin , /sbin , /usr/bin , and /usr/sbin , but your terminal knows where to find them (thanks to something called the PATH). Other commands are built into your terminal. You don’t have to worry about whether a command was installed or comes built-in because your terminal knows the commands either way. Better yet, on most Linux distributions, when your terminal can’t find a command, it searches the internet for a package to provide that command and then offers to install and run it for you!

The ls command is short for «list,» and it lists the contents of your current directory. Open a terminal and try it out. Then open a file manager window (Files on Linux, Finder on macOS, Windows Explorer on Windows) and compare. It’s two different views of the same data.

Читайте также:  Linux see if file is open

What is an argument in a Linux command?

An argument is any part of a command that isn’t the command. For instance, to list the contents of a specific directory, you can provide the name of that directory as an argument:

In this example, ls is the command and Documents is the argument. This would render a list of your Documents directory’s contents.

What are options in Linux?

Command options, also called flags or switches, are part of command arguments. A command argument is anything that follows a command, and an option is usually (but not always) demarcated by a dash or double dashes. For instance:

In this example, —classify is an option. It also has a short version because terminal users tend to prefer the efficiency of less typing:

Short options can usually be combined. Here’s an ls command combining the -l option with the —human-readable , —classify , and —ignore-backups options:

Some options can take arguments themselves. For instance, the —format option for ls lets you change how information is presented. By default, the contents of directories are provided to you in columns, but if you need them to be listed in a comma-delimited list, you can set format to comma :

$ ls --format=comma Documents alluvial, android-info.txt, arduinoIntro, dmschema, headers.snippet, twine, workshop.odt

The equal sign ( = ) is optional, so this works just as well:

$ ls --format comma Documents alluvial, android-info.txt, arduinoIntro, dmschema, headers.snippet, twine, workshop.odt

Learning to use the Linux terminal

Learning how to use a terminal can increase efficiency and productivity—and can also make computing a lot of fun. There are few times when I run a carefully crafted command and don’t sit back marveling at what I’ve managed to make happen with just a few words typed into an otherwise blank screen. A terminal is many things—programming, poetry, puzzle, and pragmatism—but no matter how you see it, it’s a lasting innovation that’s worth learning.

After reading and practicing the lessons in these articles, download our free ebook, Sysadmin’s guide to Bash scripting for even more fun in the terminal.

Источник

What are various options / arguments for «./configure» in Linux

I have seen that while installing new software in Linux, I always have to use first configure it. But sometimes we need to pass various options like I did today to install lxml :

./configure --with-python=/opt/python27/bin/python --prefix=/usr/local --with-libxml-prefix=/usr/local --with-libxml-include-prefix=/usr/local/include --with-libxml-libs-prefix=/usr/local/lib 
  1. Are those parameters same across all software packages or they vary software to software?
  2. I even tried to read documentation as well, but no one mentions those parameters.

I can only speak in lay mans terms on this — but writing ./configure then accessing auto-complete (tab) you will get a list of possible options. These are most definately unique, depending on the actual software.

Читайте также:  Нет свободного пространства linux

@Mikaveli: Seriously? It’s an autogenerated script created to be as portable and robust (instead of readable) as possible, and hence extremely unreadable (just like the makefiles generated by it), not meant for manual inspection. ./configure —help is the way to go. Just follow an abritary autotools tutorial, generate the configure script from its super-simple configure.in and try reading that.

@delnan: I’ve also seen a lot of manually created configure scripts too, so I always start by giving it a quick once over. 🙂

4 Answers 4

That will show you all options for that particular configure script.

Never knew that was a standard practice. wow. I love that for applications and commands in the CLI, wonderful to know ./configure [OPTION] s can be listed. Thanks for the answer

This doesn’t appear to be exhaustive. Ex: «—disable-shared» isn’t listed, but «—disable-FEATURE» is, but one must look elsewhere for what «FEATURE[s]» are available. Which is what I’m looking for, and lead me here. So now I must RTFM myself.

Some are the same across all configure scripts produced by Autoconf (which is most of them, but not all); for instance —prefix is basically universal. Others are peculiar to the particular configure script.

./configure —help is always helpful. But I would say more about that in some packages not only is there a configure script in the top source directory but also the possible subdirectories. So, for knowing all possible parameters which can be passed to the configure script in the top source directory you should also have a look at the configure scripts in each possible subdirectory.

For example, in the top source directory of binutils-2.34 tarball there are —with-sysroot and —with-lib-path parameters with configure script. If you type ./configure —help under the top source directory, there are no document items for both of them because they are documented in the configure script under the subdirectory ld/ . So you should type ./ld/configure —help .

I know about configure —help but the information provided is «light». The following GNU resources contain useful additional information:

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.13.43531

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Оцените статью
Adblock
detector