The command-line is the interactive interface to your shell.

learn more… | top users | synonyms (1)

74
votes
8answers
103k views

ssh-add complains: Could not open a connection to your authentication agent

I've been trying to get ssh-add working on a RaspberryPi running Raspbian. I can start ssh-agent, when I do it gives the following output into the terminal: ...
0
votes
0answers
40 views

Editing a child JSON element value with jq

I'm trying to use jq in order to change a child's value. For instance, I want to change the value of "test2" from ["yo", "bye"] to ["hi"]. { "title": "hello", "body": { "test1": 123, ...
1
vote
1answer
50 views

How to Count the Number of Lines of an Output?

Let say I have the program: Calculate.py Is there a unix command-line that counts the number of lines outputted from my program, Calculate.py?
38
votes
9answers
99k views

What is the fastest way to view images from the terminal?

The terminal is very fast and convenient way to quickly access directories and files (faster than find and click on the directory). One thing that it cannot show in text-mode is "pictures". What ...
15
votes
2answers
7k views

What is meant by a shell is in “vi” mode or “emacs” mode?

This question follows directly from the answer to one of my previous questions here. I am newbie to unix world and this site has helped a lot to understand some core concepts. In this case I am ...
1
vote
3answers
43 views

combine selected column multi file

I have multiple files (~15), each with multi column data (tab seperated). For example: File1 aa1 399 1815 aa2 1908 4064 aa3 4523 5656 File2 bb1 5304317 5305057 bb2 ...
1
vote
1answer
38 views

How to run commands on user login — that are NOT already running

I often run a series of poor-man daemons when I am sshing into my headless server. One to monitor the beer in my kegs and one to monitor the server itself from a web-browser. I do this by running ...
1
vote
1answer
27 views

Is there any way to list the latest GUI transactions in Linux?

Suppose that I've moved a directory in my Xfc desktop in another directory, which I can't remember the name of the destination directory. Is there any way to list the latest transactions in ...
0
votes
2answers
76 views

In a folder with many files how to do rm on lots of them [duplicate]

I just experimented a bit in linux and ended up getting very many files in one and the same folder. Now when I try to do rm -f folder/*.png I get -bash: /bin/rm: Argument list too long ...
0
votes
1answer
23 views

browse local S3 storage (not Amazon) with command line tool

I wish to browse, put and get files in local S3 storage from vendor EMC Atmos Cloud Storage I have a RHEL7 and wish to do it on command line. We have no flat structure (like Amazon) we use ...
1
vote
1answer
45 views

pipe the output of cat into a node script

I am an absolute beginner at UNIX scripting (and have searched here for something explaining how to do this in a simple way to no avail). I am trying to pipe the contents of a claimName.txt file find ...
4
votes
2answers
66 views

how to tell firefox to shutdown cleanly from tty1?

Lately I run Firefox almost exclusively from on one of my Debian laptops (which run testing). Occasionally (~monthly) my desktop/tty7 hangs, in which case I usually can goto tty1 and sudo shutdown ...
1
vote
1answer
52 views

How to read from stdin in process substitution? [duplicate]

I would like to send stdout to multiple commands, however I'm not sure how do I read from standard input within process substitution? My attempts: $ echo foo >(cat /dev/stdin) >(cat ...
16
votes
2answers
17k views

Is there a simple command for outputting tab-delimited columns in bash?

E.g. I have a file (produced with echo -e "var1\tvar2\t\var3\tvar4" > foo) that are output (in bash): $ cat foo case elems meshing nlsys uniform 2350 0.076662 2.78 non-conformal ...
4
votes
4answers
827 views

Find the last occurence of a string in a given filetype in all subdirectories

I have multiple sub-directories each with different depths. I need to search for the last occurrence of a string in a specific file type (say *.out). How can I accomplish this? I have tried: grep -r ...
1
vote
3answers
74 views

Command line tool to check when a URL was updated?

It would certainly be possible to whip together something in Python to query a URL to see when it was last modified, using the HTTP headers, but I wondered if there is an existing tool that can do ...
0
votes
1answer
87 views

Re-encoding video with ffmpeg including all subtitles but not all audio

I'm trying to re-encode video streams from a Matroska file to save space, while keeping all the subtitles as-is, using ffmpeg. I want to write a generic command that works without me having to specify ...
49
votes
4answers
32k views

How to redirect output of wget as input to unzip?

I have to download a file from this link. The file download is a zip file which I will have to unzip in the current folder. Normally, I would download it first, then run the unzip command. $ wget ...
11
votes
3answers
2k views

Is there a way to simulate a “Close” event on various windows using the terminal?

I answered on Ask Ubuntu Quit all instances of gnome-terminal via a command but as you all can read gnome-terminal didn't seems to have a SIGcall I could use to simulate this "Close" event. So this ...
4
votes
5answers
437 views

How to prepend a particular text file contents to every text file in a directory and its subdirectories?

I hate to clutter my source code files with licensing/attribution comments but some times it is a requirement. So having dozens of source code files (organized in a tree of subdirectories) written I ...
1
vote
1answer
26 views

Difference between writing `function Name { …; }`, `Name () { …; }` and `function Name () { …; }` in bash [duplicate]

You can write a bash functions several ways: function JoinStrings { ...; } Or function JoinStrings () { ...; } Or JoinStrings () { ...; } Is there any difference between these ...
3
votes
3answers
168 views

Repeating command with different filenames

Here's a layup for someone... I'm having to run a command repeatedly: $ wp input csv MyCSV01.csv directory_name $ wp input csv MyCSV02.csv directory_name $ wp input csv MyCSV03.csv directory_name ...
5
votes
1answer
2k views

Crop SVG drawing to canvas size in command line

I have SVG images produced by PlantUML, which has some parts of drawing outside of canvas. It makes it difficult to use such images and I need to crop drawing to canvas size. As I produce UML diagrams ...
10
votes
7answers
8k views

Terminal-based spreadsheets and wordprocessor?

Are there any (good) terminal based (ie. runs in a VT, not in GUI/X) spreadsheets or wordprocessors for Unix/Linux? Can anybody remember the name of such programs which were popular before (eg. ...
2
votes
1answer
33 views

How to emulate returning arbitrary values from shell functions?

Shell functions are just statements and they don't return values. Can anyone share best practice on writing functions that return values in bash? Let's say I've a function that joins two strings: ...
0
votes
0answers
17 views

Difference between “$@” and “$*” when passing arguments to bash function [duplicate]

I'm having hard time understanding difference between $@ and $* when passing them to functions. Here is example: function a { echo "-$1-" "-$2-" "-$3-"; } function b { a "$@" } function c ...
3
votes
3answers
4k views

How to permanently enable scl CentOS 6.4?

I installed a newer version of devtoolset (1.1) and was wondering how I would go about permanently setting these to be default. Right now, when I ssh into my server running CentOS, I have to run this ...
1
vote
2answers
37 views

path of folder within a folder in terminal

I have a number of files that are saved as Year -> Month -> Day -> bunch of .nc files I would like to generate a list of all of the directories that contain the nc files. I can list the ...
1
vote
1answer
38 views

Why doesn't cc (the C compiler) and similar utilities use standard streams by default? [closed]

Background If think most of us agree that filters and pipes are the very foundation of Unix systems. Pipes and filters are very powerful tools. Almost all Unix utilities use the standard input and ...
1
vote
1answer
101 views

Error when exporting the result of a valid command as a bash variable

I'm trying to export the result of a command line as en environment variable. Here is how I'm doing it: group_id=$(aws ec2 describe-security-groups --filters Name=group-name,Values=${group_name} \ ...
2
votes
2answers
61 views

How to kill line of PID?

I have process which created multiple PID's. I want to kill all those PID's. I have tried pkill <process_name>. But PID not getting killed as they were wait to resource releasing. I have ...
0
votes
1answer
28 views

Thunar custom action: Extraction to subdirectories

I am attempting to create a Custom Action in Thunar (File Manager) that will extract a gzip archive into a subdirectory of the same name (e.g. abc.tar.gz to abc/). I created this command, which works, ...
1
vote
3answers
70 views

How to search for available software in repositories though CLI?

I want to be able to search all available software like one would using "Synaptic Package manager" or "Ubuntu Software Center" through Command Line.` I want a better way than pressing Tab after ...
-1
votes
3answers
87 views

cannot move Directory not empty

Edited due to people want to know more then me just wanting to know how to deal with two directories with same names in different places and move one into another when mv will not allow it if files ...
2
votes
4answers
226 views

Interactively add arguments line-by-line in bash

Sometimes it happens that I have a list of files or strings in the clipboard and want to paste it as an argument list in a bash shell: Example file list (only an example): createsnapshot.sh ...
9
votes
2answers
5k views

“Argument list too long”: How do I deal with it, without changing my command?

When I run a command like ls */*/*/*/*.jpg, I get the error -bash: /bin/ls: Argument list too long I know why this happens: it is because there is a kernel limit on the amount of space for ...
11
votes
6answers
11k views

date: get current 15 minute interval

Is there any way I can get the current 15 minute interval using the date command or similar ? e.g. something like date %Y.%m.%d %H:%M will give me 2011.02.22 10:19 , I need something that yields ...
3
votes
5answers
515 views

How can I run a specific line as a command in a text file?

Sometimes I need to exec a single command which is in a shell script. I already know sed -n 'line_num p' can print that line. But how can I exec that printed out specific line as a command?
1
vote
3answers
31 views

kill bash loop executed from command line [duplicate]

I run my command in a loop. I wrote the loop directly to a bash command line: $ while true; do mycommand; done mycommand is a command doing a lot of io and waiting for events so it does not consume ...
1
vote
3answers
154 views

Opening current directory from a terminal onto a file browser?

My current directory is buried deep in multiple subfolder layers from my home directory. If I want to open this directory in a gui-based file browser, I have to double click folder after folder to ...
0
votes
0answers
18 views

Bash previous command refresh is messed up [duplicate]

I'm running on a mac with el Capitan. I'm at the command prompt, running bash. When I hit the up-arrow, sometimes it's as if it thinks that my prompt is much longer than it is? The first part of the ...
7
votes
2answers
5k views

How to fix intermittant “No space left on device” errors during mv when device has plenty of space?

Ubuntu 14.04 on a desktop Source Drive: /dev/sda1: 5TB ext4 single drive volume Target Volume: /dev/mapper/archive-lvarchive: raid6 (mdadm) 18TB volume with lvm partition and ext4 There are ...
1
vote
0answers
52 views

Is there a way to change KDE4 display settings from the command line?

Consider the following setup: My laptop is normally located at my desk connected to power, external keyboard and mouse and an external monitor. Since the laptop's screen is pretty small and my monitor ...
0
votes
1answer
19 views

Splitting a flac from a cuesheet metadata block

Some flac files apparently have a “cuesheet metadata block”. I know how to split flacs files with shnsplit when I have a separate cuesheet at hand (cf. “How do I split a flac with a cue?”), but how do ...
5
votes
3answers
104 views

Is “Arithmetic Expansion” the expected action on vars inside `[[` tests?

This script: a=2 [[ "$a" -eq 2 ]] && echo yes1 [[ $a -eq 2 ]] && echo yes2 [[ a -eq 2 ]] && echo yes3 [[ "a" -eq 2 ]] && echo yes4 Does not work in dash (and ...
2
votes
1answer
2k views

Cannot remove iwlwifi module, even though interface is down

When I run the following two commands, the first one returns without eror, but the second one gives me FATAL: Module iwlwifi is in use. sudo ifconfig wlan0 down sudo modprobe -r iwlwifi If bringing ...
3
votes
4answers
248 views

How to show an environment variable's current value?

When I check on my system's environment, a lot of environmental variables will pop up. How can I just search for a particular variable? A book I'm reading says: Sometimes the number of variables ...
-2
votes
1answer
119 views

Bash: How can I replace a string in a previous command?

I need to replace a word in line or URL but I need to do it from command line/terminal. I mean $ ./myscript.sh xxx.xxx.xxx.xxx:8080/code -c code1 -t query Now from there, without going back, I ...
9
votes
2answers
19k views

How to write text into the first line of a file?

I've been looking around sed command to add text into a file in a specific line. This works adding text after line 1: sed '1 a\ But I want to add it before line 1. It would be: sed '0 a\ but I ...
10
votes
2answers
110k views

Installing git “sudo: apt-get: command not found”

I am trying to install git. I run the following command: sudo apt-get install git-core git-gui git-doc But receive the following error: sudo: apt-get: command not found What should I do?