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

learn more… | top users | synonyms (1)

6
votes
4answers
143 views

How to grep-inverse-match and exclude “after” and “before” lines

Consider a text file with the following entries: aaa bbb ccc ddd eee fff ggg hhh iii Given a pattern (e.g. fff), I would like to grep the file above to get in the output: everything except ...
1
vote
1answer
33 views

Using apropos command with -a to search multiple keywords on CentOS 7

I'm running CentOS 7.0 build 1503. I'm trying to search for commands I don't know the name of by searching the man descriptions for multiple keywords using AND (e.g. search for a command containing ...
0
votes
1answer
24 views

How to kill only current process and continue with shell pipe-line?

I have 2 related Doubts about Bash. (Q1) Consider tail -f SomeFile | wc, a fictitious command-line, where tail is used to simulate a command (C1) which runs for a long time, with some output from ...
24
votes
5answers
15k views

Filtering invalid utf8

I have a text file in an unknown or mixed encoding. I want to see the lines that contain a byte sequence that is not valid UTF-8 (by piping the text file into some program). Equivalently, I want to ...
0
votes
3answers
85 views

Tilde on unix:hpux and / or solaris

On Linux press F9 return a correct ~ On unix(solaris or hpux) return 0~ How to set correct tilde on those systems?
0
votes
2answers
956 views

Bring up shutdown menu of Cinnamon via command line

How can I bring up the shutdown menu of Cinnamon via command line? Note: I don't want the user menu. This menu for switching or logging out a user is brought up via Ctrl+Alt+Del.
1
vote
1answer
49 views

What does blkid stand for?

What does the command blkid stand for? I want a way to remember it. Also, what is it often used for?
7
votes
2answers
79k 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?
0
votes
0answers
15 views

How to make a background service to capture commands and their output?

Is there anyway to make a background service capture all the commands executed by a user and also save the output in a text file?
8
votes
6answers
5k 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. ...
1
vote
1answer
54 views

How to get last N commands from history?

I want to see what are the last N commands in my history. I thought history | tail -n 5 would make it, but I noticed that a multiline command counts for as many lines as it has. $ echo "hello how are ...
4
votes
4answers
167 views

How can I convert two-valued text data to binary (bit-representation)

I have a text file with two (2) only possible characters (and maybe new lines \n). Example: ABBBAAAABBBBBABBABBBABBB (Size 24 bytes) How can I convert this to a binary file, meaning a bit ...
3
votes
1answer
31 views

Background color whitespace when end of the terminal reached

I am working with control sequences for text formatting and have stumbled upon some unexpected behavior. I have some text to output, in the middle of this text there is some smaller text block ...
6
votes
4answers
804 views

Add a newline into a filename with `mv`

It's a serious question. I test some awk scripts and I need files with a newline in their names. Is it possible to add a newline into a filename with mv? I now, I can do this with touch: touch ...
2
votes
3answers
147 views

How can I select and copy file names in the command line without using the mouse?

Typically, when I want to perform an action on a file I discovered in the terminal after calling [ls], I would have to - with my mouse - highlight, left click, copy file name, type the command in then ...
2
votes
1answer
43 views

How to save a file from an initramfs emergency shell?

I can't boot because of some strange error. There is an error report file generated for me, to supposedly submit it along with a bug report, or whatever. So to help me figure out what the problem is, ...
11
votes
8answers
2k views

What to use when the “ls” command doesn't work?

I tried to use the ls command and got an error: bash: /bin/ls: cannot execute binary file What can I use instead of this command?
15
votes
4answers
55k views

Connecting to wifi network through command line

I am trying to connect to my WEP network just using the command-line (Linux). I run: sudo iwconfig wlan0 mode Managed essid 'my_network' key 'xx:xx:... hex key, 26 digits' Then I try to obtain an ...
152
votes
31answers
82k views

Tracking down where disk space has gone on Linux?

When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time ...
10
votes
7answers
16k views

Getting cpu usage same every time.

When I execute following command to get cpu usage , I get nice + user cpu usage. top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}' Output: 14.5 Here I am getting problem is that the output ...
17
votes
6answers
15k views

How can I see dmesg output as it changes?

I'm writing a device driver that prints error message into ring buffer dmesg output. I want to see the output of dmesg as it changes. How can I do this?
1
vote
2answers
36 views

Extract lines from a file using vim or teminal

I have the following in a file. I'd like to use Vim or terminal to extract title and its content like this. How can I achieve this? Topic 1 - Core: Algebra 1.1 Arithmetic sequences and series; sum ...
-1
votes
2answers
32 views

Need advice fixing this source error in Kali Linux

W: GPG error: http://http.kali `enter code here`.org kali Release: The following signatures were invalid: BADSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org> *This is the result i ...
1
vote
2answers
143 views

Another awk(ward) question - mapping substrings with multi-keys

I have two files that look like this: mapping.txt: 100178 L08/2015 100180 L08/2015 103822 J03/2012 103823 A06/2012 103823 J02/2012 103823 J03/2012 ... input.txt: 100180011|225| ...
1
vote
0answers
40 views

osx - dd command behaving weirdly [duplicate]

I've been using dd for a couple of years now, most of the time successfully. I usually use it to dd Linux images to USB drives. My workflow doing so is as such: convert .iso image to a .img format ...
8
votes
4answers
53k views

How do I exit or cancel a bad bash command?

I expect to get some flak for this, but I can't find the answer anywhere. It seems like it should be so obvious. Sometimes, when I type a bad command in a bash terminal, the cursor just jumps down to ...
0
votes
1answer
31 views

Open a webpage and enter a username and password via CLI

Ultimately, I want to use a bash script to automatically open and log into a website. I was wondering if I could use the curl or elinks commands to log in to a website and then somehow export that ...
-3
votes
0answers
35 views

How to save output of a python command to a file [closed]

I am writing a script and part of it is print "\nSOURCE CODE COMMAND: "+source_code_command print "\n" exec source_code_command outfile > output.txt Third line is throwing error. While ...
0
votes
0answers
20 views

how to hardsubbed avi files with Hnadbrake CLI bash script

is there a way to hardsubbed avi files with Handbrake CLI ? i use this bash script below to convert all avi files in a directory but have no idea how to make hardsubbed video with this bash script. ...
67
votes
9answers
21k views

How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or minus)?

How do you remove a file whose filename begins with a dash (hyphen or minus) -? I'm ssh'd into a remote OSX server and I have this file in my directory: tohru:~ $ ls -l total 8 -rw-r--r-- 1 me ...
6
votes
2answers
80 views

Why does the terminal echo keystrokes when commands are running?

I was recently running tail -f on a log file of a server that was running, trying to diagnose a bug, when I accidentally bumped the keyboard and typed some characters. They got mixed in with the ...
0
votes
1answer
3k views

Proper escaping of double quotations for curl post data?

I'm trying to test out a server, by sending it JSON data and reading the response. I need to POST data like {"item":"value with spaces"} but when I use curl I find that it sends the backslashes as ...
-2
votes
1answer
21 views

Get CIDR of my IP on the WAN

I have a script that updates some remote systems with my laptop's IP and CIDR on the WAN, how the Internet sees me, in other words. I use the following to get my IP on the WAN in bash: dig +short ...
4
votes
2answers
15k views

Command to install linux headers fails

I need to install my linux headers for an Nvidia driver install. But I get an error when doing so: peter@peter-deb:~$ sudo apt-get install linux-headers-$(uname -r) Reading package lists... Done ...
5
votes
1answer
636 views

What's the difference between \b and \< in the grep command

In the man page of grep, I see The symbols \< and \> respectively match the empty string at the beginning and end of a word. The symbol \b matches the empty string at the edge of a ...
3
votes
8answers
3k views

grepping dotfiles with -R correctly?

From time to time I need to find a culprit in an unknown dotfile and instead of trying to figure out which package is to be blamed (e.g. xfce4 or thunar?) and what is their naming convention (.app vs ...
4
votes
2answers
346 views

How to install / parse build dependencies from debian/control?

Let's suppose you downloaded a source code folder, that contains an existing /debian/ folder as well as /debian/control file. Let's suppose the package in question is not in Debian official ...
2
votes
4answers
375 views

What is the difference between (cp f1.txt f2.txt) & (less f1.txt > f2.txt) [duplicate]

I know that both will copy data from f1.txt to f2.txt, but what is the real difference? (cp f1.txt f2.txt) vs: (less f1.txt > f2.txt)
0
votes
0answers
13 views

Download Hotlinked Images from Forum from Command Line

From the command line, is it possible to download linked images posted on forums? I want to enter the forum thread url and maybe stipulate which image hosts to detect. Also some threads will have ...
1
vote
5answers
9k views

checking running process

I am new babe to Linux. So please skip to read if you are not patient with begineer. Let's say I am asked to check and shut down the processes that I am not familiar with. So when I ls under bin ...
1
vote
4answers
11k views

How to send many commands to shell and wait for the command behind ends

Hello I have around 20 commands and I have to send all of this to Unix shell, and copy the result, but I don't know how to do it. I am not sure about what shell I have, because it is a small program ...
0
votes
3answers
22 views

how to show port numbers that are listening for the incoming connections under TCPv4?

I want to use command line to show only the port numbers after ":" only This is what I'm trying to do sudo netstat -ant |grep LISTEN|grep :|sort -n|cut -c 45- It shouldn't list any tcp6 info
120
votes
15answers
53k views

How to have tail -f show colored output

I'd like to be able to tail the output of a server log file that has messages like: INFO SEVERE etc, and if it's SEVERE, show the line in red; if it's INFO, in green. What kind of alias can I ...
6
votes
2answers
6k views

How to grep the output of cURL?

I need to retrieve the expiry date of an SSL cert. The curl application does provide this information: $ curl -v https://google.com/ * Hostname was NOT found in DNS cache * Trying ...
-2
votes
0answers
28 views

Chmod 777 in Windows 7 [migrated]

I use Window 7 and i need to create a new .dat file in the principale partition C:. But i can't do that because i don't have all the permissions. I run the cmd as administrator and i try again but ...
5
votes
2answers
163 views

How to gather byte occurance statistics in binary file?

I'd like to know the equivalent of cat inputfile | sed 's/\(.\)/\1\n/g' | sort | uniq -c presented in ...
0
votes
1answer
20 views

Set the active tmux tab color

Is it possible to change the background of the active (current) tmux tab? I'm using tmux 1.9 on Ubuntu 15.04. $ tmux -V tmux 1.9 I tried to do: set-option -g pane-active-border-fg red But the ...
1
vote
1answer
30 views

How can I cache the PGP unlock for unix pass when I am in the virtual terminal?

When I am running in the GUI, if I run the pass command to read a password such as pass -c Email/FooBar, a password prompt will appear for my passphrase. If I type my password, my password will be ...
0
votes
0answers
31 views

How must (Not how can) a program be available from everywhere in CentOS/Fedora

I was reading this link from MySQL: https://dev.mysql.com/doc/refman/5.6/en/mysql-cluster-install-linux-binary.html shell> cp support-files/mysql.server /etc/rc.d/init.d/ shell> chmod +x ...
5
votes
1answer
650 views

How to write/edit/update the OsIndications efi variable from command line?

In the need to enter the UEFI firmware setup utility while using ultra fast boot (keyboard drivers are not loaded during POST), I wish to write to the "Os Indications" efi variable. My OS is Ubuntu ...