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

learn more… | top users | synonyms (1)

2
votes
3answers
44 views

Get last part of string after hyphen

Is there a simple command line to extract the last part of a string separated by hyphens? E.g., I want to extract 123 from foo-bar-123.
6
votes
3answers
166 views

How can I implement a circular flow of data among interconnected commands?

I know of two types how commands can be connected with each other: by using a Pipe (putting std-output into std-input of the next command). by using a Tee (splice the output into many ...
2
votes
1answer
23 views

Need to press enter to get prompt after executing udev script

I have set a simple udev rule for my Raspberry Pi (Debian) to automatically mount an USB HDD. It just runs a script which mounts all devices in /etc/fstab since it's the only one I have and I'm going ...
2
votes
0answers
27 views

Bash: “history number” vs “command number”

While Googling how to customize my shell prompt via the PS1 variable, I'm seeing tables of special characters that can be used. In particular: \! the history number of this command ...
0
votes
1answer
47 views

How can I translate in the CLI an English word into a German one?

I want to write a Script that picks a random English word from /usr/share/dict/words, translates it into German, display both of them for a certain amount of time and repeat the process. I only know ...
1
vote
1answer
15 views

How to exclude the folders proc and sys from search with find command ?

I wanted to execute a script that picks out a random directory path: find / -type d | shuf -n1 Unfortunately I get error messages about the prohibition of entering certain directories. How can I ...
4
votes
1answer
68 views

How to perform the watch command onto expression with pipes?

I learned today the wonderful shuf command: ls | shuf shows me a listing of the working direcotry, but thanks to shuf each time I execute this piped command expression with another order. So I ...
5
votes
1answer
314 views

How to copy a file several times into randomly choosen paths within the filesystem?

I have a filesystem and a special file foo. I would like the script to choose several times (5,10 or 100) random paths to folders within this filesystem and to copy the file foo into each of them. ...
0
votes
1answer
28 views

Can not evoke watch command with non-integer time option

I want to start the w command periodically, according to man watch the smallest possible time interval is 0.1. I tried: watch -n1 w (works) watch -n1.5 w (does not work) watch -n0.1 w ...
0
votes
0answers
35 views

How do I realize a Shell Script that keeps track of how long the keyboard has not been used ?

Is it possible to write a script that counts the time between two pressed keys, so that one could put a script into the crontab that checks if the keyboard had not been for longer than a certain time ...
2
votes
4answers
115 views

How can I create new shell commands?

I'm using bash, and I want to be able to execute a script just by typing its name as a command, same as pwd for example. Is there a specific directory where I need to save my script to, or any other ...
1
vote
2answers
41 views

pipe in shell with redirection

My understanding is that a pipe in shell like a | b redirects b's stdin to a's stdout. However, I tried ls | less < somefile, the behavior is very strange. less shows the output of ls concatenated ...
0
votes
1answer
17 views

Error I get when I try install IDE Anjuta

sudo apt-get install anjuta Error I get while installing the IDE. What is this error about? However, I am able to successfully install the IDE Unknown media type in type 'all/all' Unknown media ...
0
votes
1answer
21 views

Imagemagick mogrify with shadow geometry

How can I specify the size of a shadow with imagemagick? This command works: montage foo.jpg bar.jpg foobar.jpg -background lightgray -geometry 1031x1642+57+57 -shadow -monitor -tile 3x1 out.png ...
2
votes
0answers
16 views

Why reading from and writing to framebuffer shows no effect ?

I read a very short description of how to make a Screenshot by making use of the file which represents the framebuffer /dev/fb0. in order to write the screen content: cat /dev/fb0 > file in ...
0
votes
1answer
40 views

How can I save the result of a continuous command?

I am trying to append the result of airodump-ng mon0 to a file. I want to run it once, append, and exit. I can repeat the command each x minutes with sleep and so.
0
votes
2answers
42 views

How to fix curl sslv3 alert handshake failure?

I'm trying to curl HTTPS website in the following way: $ curl -v https://thepiratebay.se/ However it fails with the error: * About to connect() to thepiratebay.se port 443 (#0) * Trying ...
5
votes
2answers
125 views

How can I list files of which no symlinks exist?

I have a large "myfiles"directory full of miscellanous documents and do not want to modify its structure. I therefore created (several) other directories for each class of documents. For example I ...
1
vote
0answers
40 views

How to generate a list of configuration files accessed by a tool (eg bash or vi)?

Many times, there are slight inconsistencies between two similar linux machines, where (for example) tmux supports colours on Machine M1, and does not support colours on Machine M2, or vi adds ...
2
votes
1answer
57 views

sudo -i returns an error

When I try to switch to root using sudo -i i get the error /var/tmp/sclDvf3Vx: line 8: -i: command not found... However, su - works which I will continue to use. I'm by no means a linux system ...
0
votes
1answer
35 views

What is the meaning of read -r ?

in order to understand another answer: find / -type d -print0 | while read -r -d ''; do ls -ltr "$dir" | sed '$!d' the first step is to understand the usage of the option -r of the read command. ...
3
votes
1answer
30 views

How to convert all odt files in a folder into microsoft word files ?

I have a folder with a lot of odt files from LibreOffice, I could open each one by hand and save it as a microsoft word file, but that would take a long time, is it possible to reach this goal using ...
1
vote
2answers
46 views

How to list only the last line of each directory?

I learned thanks to you, how to display only the last line of a listing,e.g. ls -ltr | sed '$!d' Now I thought, how to combine it with the find command, in order to repeat this onto each directory ...
0
votes
3answers
38 views

How to display only the last line of a listing ?

Supposed I make a listing and sort the files by its temporal attribute: ls -ltr -rwxrwxrwx 1 bla bla 4096 Feb 01 20:10 foo1 -rwxrwxrwx 1 bla bla 4096 Feb 01 20:12 foo2 . . . -rwxrwxrwx 1 bla bla ...
1
vote
0answers
6 views

Is it possible to make a key word search of all existing channels of all the irc networks from the command line ?

I am new to IRC (internet relay chat), as I understand it, an IRC network has a unique name like DALnet, is made of a chain of servers, a person can connect to one of them in order to connect to the ...
1
vote
0answers
31 views

Why won't my python scripts run without the python command when moved from Windows to Linux? [duplicate]

I have some Python files that I wrote on my Windows PC and then sent over to a Linux machine using pscp. They work as intended on Windows, but when I try to execute them on the Linux machine, I always ...
-3
votes
1answer
40 views

does curl -Ls 'http://pastebin.com/raw.php?i=r2jYDZaw' mean it will not output anything?

Does the s in -Ls mean that nothing should be outputted? If so what will be the output then?
2
votes
4answers
47 views

input file stream to command

How is it possible to send a file stream to this command instead of a file? /usr/local/bin/wkhtmltopdf --title "$SUBJECT" -q $SOURCEFILE $OUTPUTFILE The file stream is from a string in PHP.
0
votes
1answer
175 views

How to find all JPG files on the file system when .jpg extension is not obligatory ? [duplicate]

First thing I noticed when switched from Windows to Linux was, that Linux has no strict naming convention and no obligatory file name extensions like .bmp, .jpg, .exe etc. Therefore I can not tell by ...
2
votes
3answers
90 views

Difficulty converting from binary to hexadecimal using bc

I read how to calculate using the command line calculator and a HERE-document, but nevertheless I do not get what I expected and can not find my error, what I did in the shell was: bc << HERE ...
0
votes
0answers
35 views

Touch a file and give it an icon image via command line

Imagine this situation: for a given task, at some point of it, I should be able to create an empty file, which I can achieve by touch file.ext on the command line. However, if I touch a .jpg file, and ...
0
votes
1answer
41 views

Search a file for a string in multiple directories

Can someone please help me with a command to search a file for a string in multiple directories? I am searching for the VIP in httpd.conf in multiple httpd instances. I am using: find ./ -name ...
1
vote
1answer
30 views

Only pipe on Success [duplicate]

Is there a way in the Linux command line, to only have a command pipe its output to another, when the command didn't fail? $ cmda | cmdb I would like it, so when cmda returns a status code other ...
0
votes
1answer
12 views

Makes it a difference whether I use a different -n flag value for xargs in combination with find command ?

Assume, someone searches for files that match some criteria using the find command and pipes the result into the rm command. find / -type f -name "*.jpg" | xargs rm First, I am not sure if the ...
1
vote
3answers
101 views

What is the reason for having numbers within the brackets of a function ? [duplicate]

I have seen on many occasions a name of a function (frankly speaking I just call it function because of it typical appearance, they are though sometimes named commands or system calls but I do not ...
3
votes
1answer
29 views

why does the output of xargs -n2 applied to the same number of arguments different whether piped or from keyboard?

when I execute xargs -n2, enter x x x x x and hit Enter, I get only 4 x back: $ xargs -n2 x x x x x x x x x But, when I pipe the x x x x x into the same command, I get the same amount of x back: ...
-2
votes
0answers
23 views

Linux command inside C code: /* treat as comment? [migrated]

In C, I want to run linux command. Namely, int status; status=system("lftp ftp://192.168.1.1 -e "mget -E /2015/Date*/*Snap/*.csv"); The * above is wildcard matching. The C compiler thinks this is ...
1
vote
1answer
53 views

cat .bash_history | grep ./configure [closed]

Why does this not give any output: cat .bash_history | grep ./configure on an system/in an shell where ./configure has been run multiple times. And if I use the arrow key's to scroll the history in ...
1
vote
1answer
52 views

Can not set the LC_TIME variable for the current process [duplicate]

On Linux Mint Rebecca, my current LC_TIME setting is LC_TIME="en_US.UTF-8" I would like to execute date and watch how the current date is displayed in a Chinese format with Chinese characters. ...
3
votes
2answers
58 views

How to list files on terminal so that we can see the file types such executable, ascii etc?

I have been trying to list files in directory using ls and passing it different options. Does it have the ability to list types of files as well ? I want to know which ones are executable , ...
0
votes
1answer
39 views

What is the logic behind the expression cat > foo << “wordofchoice” [duplicate]

I know the > and >> operators, > puts something into a file by deleting the old content, >> appends something onto the end of the file's content. When I only use cat > foo I am able to write ...
1
vote
1answer
31 views

How to configure the system in order beeing able to hear the sound of the \a escape character?

I read, that if I execute: echo -e "\a" a sound emerges, but frankly speaking, i executed this command several times and no sound happened.
5
votes
4answers
239 views

How to put a newline special character into a file using the echo command and redirection operator?

I would like to create a file by using the echo command and the redirection operator, the file should be made of a few lines. I tried to include a newline by "\n" inside the string: echo "first ...
0
votes
0answers
15 views

Dropped connections with b43 driver using Broadcom BCM43228 wireless chip on Arch Linux

I managed to get my wireless working with the b43-firmware package in the AUR and for at least a month it worked perfectly. However, recently the internet connection has been dropping out. I'm ...
1
vote
2answers
35 views

Open Firefox twice (with same profile)

There are tons of resources that tell how to run several instances of Firefox in parrallel. I can't find any that tells me how to configure a command (on a command line, start menu item, or panel ...
0
votes
1answer
21 views

. as a command line argument to a command running in background

I run grep some-string -r . &. While it is running in bkg, I cd to another directory. It seems that grep interprets the hard link . differently then. What happens before and after I change the ...
1
vote
1answer
47 views

How to Prompt the user to press Enter to Exit in terminal so that the terminal doesn't close automatically?

Here is my Port.sh file echo 'Give me a maximum of 5 seconds to run please.' lsof -i | grep Xvnc | grep ESTABLISHED | grep $USER lsof -i | grep $USER | grep Xvnc | grep -o -P '(?<=:).*(?=->)' ...
1
vote
1answer
23 views

How to determine the only additional file in otherwise two identical listings?

I have done a listing of the device folder two times, one time without the sd-card in the slot and one time inserted, the system automatically adds one file in the device folder. $ ls /dev | wc -l ...
3
votes
2answers
228 views

How to Find UID, GID, and any groups I belong to?

How to Find UID, GID, and any groups I belong to ?
5
votes
2answers
196 views

How to count duplicated last columns without removing them?

I have a file that contains 4 columns. I want to compare the last three columns and count how many times they occur without deleting any of the lines. I just want the count to be present in front of ...