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

learn more… | top users | synonyms (1)

8
votes
2answers
83k 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
20 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
71 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
183 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
42 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
848 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
246 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
58 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
7answers
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?
16
votes
4answers
61k 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 ...
157
votes
31answers
91k 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
17k 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 ...
19
votes
6answers
16k 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
39 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
157 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
152 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
59k 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
59 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 ...
68
votes
9answers
23k 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
95 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 ...
-2
votes
1answer
33 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
16k 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
686 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 ...
2
votes
4answers
393 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
20 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 ...
2
votes
4answers
12k 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
26 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
10
votes
2answers
8k 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 ...
5
votes
2answers
182 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
28 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
33 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 ...
-1
votes
1answer
80 views

How to recover the deleted file from linux system? [duplicate]

I am using centos7 locally. Mistaken I deleted text file(keystone.conf.disabled) using rm, from /etc/httpd/conf.d directory, How to recover this file. This file is very important to me. Please help ...
1
vote
1answer
21 views

Bad ID3 tags when transfering mp3 to another device

I created mp3 files in Linux with mp3wrap application and then I applied ID3 tags on it as follows $ for i in *.mp3; do mp3info -t ${i%.*} -l yes1 -a yes $i; done When I look at particular mp3 file ...
2
votes
2answers
31 views

In find -perm, what's the difference between “+6000” and “/6000”?

I'm trying to find all the setuid/setgid binaries on my system. I've found two different ways to do this online. What's the difference between find / -perm +6000 -type f and find / -perm /6000 ...
9
votes
4answers
7k views

How to perform grep on FTP?

I tried searching for similar command in ncftp (actually this is the only terminal ftp client I used) and I didn't find it. What's the way (if possible at all) to use grep command on remote server, ...
23
votes
11answers
11k views

Is there a robust command line tool for processing csv files?

I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases cut, head, tail, and friends will do the job; however, cut cannot easily ...
0
votes
1answer
49 views

Describe the prompt I see when I first logged into the Linux computer

Can you please describe and explain each part of the command prompt pi@raspberrypi ~ $ This is what I saw when I first logged in to my Linux computer.
0
votes
0answers
30 views

What is the difference between “. ./command” and just “./command”? [duplicate]

I know that you do "./command" to signify to look in the current folder for the name of the executable . . . but why do you need to do "dot space dot slash command" sometimes? Like, when you are ...
0
votes
2answers
54 views

How do I add Metasploit into my PATH variable?

I have Metasploit installed on my Mac in /usr/local/share/msf. Everytime I want to use it I have to cd into that directory and use msfconsole. If I try to /usr/local/share/msf/msfconsole in my home ...
2
votes
2answers
60 views

How can I shuffle pages from a pdf file in a random order?

I would like to shuffle the pages of a pdf document in a random order. How can this be done?
56
votes
6answers
77k 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: ...
-3
votes
1answer
71 views

What command would I issue in order to complete this question?

So I have tried over 10 different attempts and I'm just stumped Here are two inverted-tree diagrams. Issue a command to change the left diagram to the right diagram. Assume that you are in your home ...
1
vote
1answer
57 views

How to write data one by one from tmp files to the final output file using for loop?

I have two tmp files named tmp1 and tmp2 which contains some lines. tmp1 file, 1c\ datafile no. 23 2c\ datafile is ok tmp2 file, 3c\ datafile no. 24 4c\ datafile is ok I have a ...
0
votes
1answer
73 views

Sending files over Samba with command line

I was wondering if there is a way to use Samba to send items to a client machine via the command line (I need to send the files from the Samba server). I know I could always use scp but first I was ...
19
votes
6answers
21k views

Sorting files according to size recursively

how to scan a folder recursively and find the largest files in the folder, and sort them by size. I have tried using ls -R -S but it tends to list the directories as well I need to scan the folders ...
1
vote
1answer
44 views

Running a program and providing input

I have a program that runs from the command line. As soon as it runs, it asks for a text value and expects the return key to be pressed after that. Is that possible to create a bash script that runs ...
25
votes
3answers
118k views

Zip all files in directory?

Is there a way to zip all files in a given directory with the zip command? I've heard of using *.*, but I want it to work for extensionless files, too.