Questions tagged [command-line]

This tag is for questions that are about using the command-line interface (CLI), including the use of standard command-line tools and shell commands. However, for questions that are specific to each shell (like Bash, ZSH etc.), use the tag of that particular shell as well.

What Questions Should Have This Tag?

  • How do I do this via command line?
  • Basic Command Line commands
  • Shell Specific commands (use shell specific tag as well)

Basic Definitions:

Command Line Interface is a way of interacting with the system and software by typing text commands into a terminal (or terminal emulator).


The command-line is also known as

  • Console
  • Terminal
  • Command prompt
  • Shell (however, be aware that applications other than the shell can have their own command line interface)

Brief Introduction to the Subject:

"Under Linux there are GUIs (graphical user interfaces), where you can point and click and drag, and hopefully get work done without first reading lots of documentation. The traditional Unix environment is a CLI (command line interface), where you type commands to tell the computer what to do. That is faster and more powerful, but requires finding out what the commands are."

from man intro(1)

Some users prefer using the command line for some tasks because it saves them time and effort. They also benefit from being able to create scripts to automate common tasks, and they can use the command line to configure their operating system on a very low level to exactly fit their needs.


Important Links for Learning More:

Questions using this tag might be related to Bash - the default command line shell in Ubuntu, Shell-Scripting and Programming.

22928 questions
19
votes
1 answer

How can I read a sh file while it is working but deleted?

In an interview they asked me this question. There was an sh file that is already running, but it has been deleted since starting the execution. They want me to find the process and read the file. I managed to find the process with ps -ef | grep…
gazagelen
  • 193
18
votes
1 answer

What does ${0%/*} in shell scripts do?

Sorry if this is a stupid question, but I searched about it without success. What does exactly the second line do ?: #!/bin/sh cd ${0%/*} || exit 1 I know the first is the shebang, the second tries to change directory but the confusing part is…
user545149
18
votes
4 answers

How to execute a Bash script from Github?

Say this I have the following file my_cool_file.sh in a Git repository in Github (or BitBucket for that matter) named my_cool_repo . The file is a script used to install ConfigServer's well known CSF-LFD software: #!/bin/bash cd /usr/src rm -fv…
Arcticooling
  • 1,865
18
votes
3 answers

How do I pipe a newline separated list as arguments to another command?

So I have a list of usernames such as: user1 user2 user3 I want to apply id on each of them and get something like: uid=100(user1) gid=5(g1) groups=5(g1),6(g6),7(g10) . . How can I achieve this? Please note that the list is the output of another…
18
votes
2 answers

How do I start screen with multiple splits directly from the command line?

I'm using screen after I have logged in with ssh to my server. As of now I set up the splits in my screen window by hand and run the commands by hand as shown in the following screen-shot: The top part should run tail -n 1 -f…
Videonauth
  • 33,915
18
votes
1 answer

How to set LD_LIBRARY_PATH permanently?

I am using Ubuntu 16. I want to use cfmid for my project. When I set LD_LIBRARY_PATH in terminal, I can get output of the cfmid library: export…
18
votes
2 answers

What's Ubuntu's default terminal spell checker?

There's a program that comes with Ubuntu 16.04 LTS by default which is run totally in the terminal and will spell check a text file. But I have trouble remembering what the program is called. What is this program, and how do I run it on…
anonymous2
  • 4,335
18
votes
3 answers

How to kill a byobu session?

byobu allows users to create multiple sessions. Once there are multiple sessions, how to kill an entire session? If there is a session foo with 3 windows and bar with 4 windows, to kill session foo , user have to run CTRL+F6 three times in each…
18
votes
5 answers

What does `ls --directory` stand for?

In my Ubuntu version the man ls has the next info about --directory: list directory entries instead of contents, and do not dereference symbolic links So I'm a little confused how it works. I used the command ls --directory and I expected a list…
18
votes
3 answers

Where does the `rename` command come from?

Where does the rename command come from? user@host> dpkg -S /usr/bin/rename dpkg-query: no path found matching pattern /usr/bin/rename
guettli
  • 1,905
18
votes
4 answers

Show full path to file in terminal

I have a file. I'd like to echo out the full path to it in the terminal. Which command would?
Karl Morrison
  • 10,096
18
votes
5 answers

Recursively search a pattern/text only in the specified file name of a directory?

I have a directory (e.g., abc/def/efg ) with many sub-directories (e.g.,: abc/def/efg/(1..300) ). All of these sub-directories have a common file (e.g., file.txt ). I want to search a string only in this file.txt excluding other files. How can I do…
18
votes
2 answers

chown: invalid option -- 'i' Try 'chown --help' for more information

I have a strange issue with the following command: # chown -R myuser:mygroup * chown: invalid option -- 'i' Try 'chown --help' for more information. the command is not aliases # type chown chown is hashed (/bin/chown) Where I can look further?
Marco Marsala
  • 353
  • 1
  • 2
  • 8
18
votes
4 answers

python subprocess.call() not working as expected

I started down this rabbit hole as a means to familiarize myself with how one would go about creating a setup script in python. The choice of python was simply rooted in my familiarity with it while I am sure there would be better alternatives than…
beeedy
  • 183
18
votes
4 answers

How to list broken packages in console

When I try to google how to do this, all the results I get are " How to fix broken packages ". Could you give me a hint how to only list them in the console one by one?
1 2 3
…
99
100