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

learn more… | top users | synonyms (1)

0
votes
3answers
65 views

Count new lines in file last 1 minute

With bash, how to count new lines appended to file the last 1 minute? What would be smartest if you want to count new lines for the last 1 minute in multiple files simultanously and get output? I ...
2
votes
3answers
263 views

How can I blank the desktop via the command line?

I'm looking for a way to hide the entire desktop + icons and then launching a single app. It's for productivity usage, if that makes any sense. How can I programmatically make my desktop blank (i.e. ...
0
votes
0answers
30 views

How to mount Thunar's SMB mountpoint using command line

I have a mountpoint that defined by Thunar, as follows: /var/run/user/1000/gvfs/smb-share\:server\=10.7.7.254\,share\=myshare1/ How to mount that connection to that specified location without ...
-4
votes
1answer
104 views

Merge two csvfiles by column header

I have two csv files: success.csv "ID","Legacy ID","Field1", "Field2" 1,1111,google,news 2,2222,yahoo,news error.csv "Legacy ID","Field1","Field2","Message" 3333,aol,news,"Failed to upload ...
0
votes
1answer
51 views

make custom commands on android 4.4.2

I want to program and debug in my android phone. To do that I downloaded c4droid and it's gcc plugin. after a lot of tries I understood that gcc is in directory ...
12
votes
4answers
3k views

How can I remove duplicates in my .bash_history, preserving order?

I really enjoying using control+r to recursively search my command history. I've found a few good options I like to use with it: # ignore duplicate commands, ignore commands starting with a space ...
0
votes
1answer
42 views

timeout pipeline

I want to execute these two timeout command on the same command but with a different time and instructions. So timeout --signal=SIGINT 5s command timeout --signal=SIGKILL 10s command How to append ...
23
votes
7answers
32k views

How can I get a count of files in a directory using the command line?

I have a directory with a large number of files. I don't see a ls switch to provide the count. Is there some command line magic to get a count of files?
170
votes
5answers
10k views

What's the difference between $(stuff) and `stuff`?

There are two syntaxes for command substitution: with dollar-parentheses and with backticks. Running top -p $(pidof init) and top -p `pidof init` gives the same output. Are these two ways of doing the ...
12
votes
3answers
9k views

find n most frequent words in a file

I want to find, say, 10 most common word in a text file. Firstly, solution should be optimized for keystrokes (in other words - my time). Secondly, for the performance. Here is what I have so far to ...
1
vote
3answers
49 views

How to express all files/directories at the extra -exec option of `find` command?

I have a task to copy all files from multiple directories with special names to a target directory. So I build this directory to test my command. The test directory tree looks like: . ├── dir1 │   ...
0
votes
1answer
96 views

Using the cURL command, how does one fetch stock data which comes back *without* commas and spaces?

What can I add to the below script so that it fetches the stock data and brings it back WITHOUT any commas and spaces? For example GOOG Outstanding shares is 675,000,000. I desire the output of ...
27
votes
6answers
16k views

Split pages in pdf

I have a scanned pdf file which has scanned two pages on one virtual page (page in pdf file). The resolution is with good quality. The problem is I have to zoom when reading and drag from left to the ...
0
votes
1answer
46 views

Is there a way to see which user is logged into the system and has switched with “su”?

There are many person that may have access to the system and use a common user with more grants. How can I see which user is running a command? is there a way to use "ps" for that?
1
vote
2answers
48 views

Change icon for an application form command line?

Is there a way to change the icon of an application's window from the command line? For instance, I'd like to have separate icons for Firefox windows under different profiles (different processes), ...
1
vote
2answers
48 views

`nl` invocation soaking all input before numbering

How can this be done? I don't see any applicable option in the manual. I have positively checked that indentation breaks after ten million lines. You can check it like: $ (for i in `seq 0 ...
6
votes
3answers
9k views

'iwlist' -> interface doesn't support scanning (Ubuntu LTS 10.04)

I am using Ubuntu 10.04 (LTS) on a Samsung N150+ netbook. I cannot scan wifi networks using iwlist and I would like to do so. Here is the output from some tests: ...
2
votes
2answers
272 views

How do I create a dialog with multiple text fields using zenity?

I want to crate a GUI for some command line programs and I need to get info from multiple text fields e.g. 'Username', 'Password' and a checkbox 'Sign automatically?'. I need to set particular ...
1
vote
1answer
58 views

Using cURL command-line tool on Mac, how does one fetch stock data which comes back *without* commas? [duplicate]

The below script is not working. cd desktop/quoteUpdate while true do curl-o quotes.txt -s "http://download.finance.yahoo.com/d/quotes.csv?s=goog,aapl&f=sl1" sed -i '.bak' 's/,/ /g' quotes.txt ...
4
votes
2answers
3k views

Why doesn't tar ask before overwriting existing files?

I lost a couple hundred lines of a Vim plugin I wrote and continue back up every so often because I extracted a tar file containing an older version. I decided not to use source control management ...
1
vote
0answers
26 views

If I cancel when prompted for my Git password, I can no longer see anything I type, until I log back in [duplicate]

Everything still works (typing "exit", for instance, exits), but I can't see anything I type. There's not "funny characters", just nothing. Even re-running git and entering the password properly ...
13
votes
6answers
1k views

Is there another simple way to append line to end of file other than `>>`?

Recently I'm echoing short sentences to a tree_hole file. I was using echo 'something' >> tree_hole to do this job. But I was always worried of what if I mis-input of > instead of >>, ...
3
votes
3answers
166 views

Strip off word pattern at the end of string using sed

I have following string: ksh -x SCRIPT2.ksh $BUSSINESSDATE & PID=$!; ksh -x SCRIPT1.ksh $BUSSINESSDATE & PID=$!; I want to strip off the last word & PID=$!;. Desired result is: ksh -x ...
3
votes
5answers
264 views

Awk - output the second line of a number of .dat files to one file

I have searched through previously asked questions and can't find an answer to what I am trying to do. note, I am new to linux. I have multiple files something like: (in reality i have 80) file1.dat ...
2
votes
3answers
1k views

Home key not working in terminal

I am using GNOME Terminal 2.7.3 and zsh 4.3.9 (x86_64-unknown-linux-gnu) Home and End are not working. Nothing happens and nothing gets displayed when I press them. but they work when I press shift + ...
1
vote
6answers
74 views

using tee to output intermediate results to stdout instead of files

I know that to capture a pipeline's contents at an intermediate stage of processing, we use tee as ls /bin /usr/bin | sort | uniq | tee abc.txt | grep out , but what if i don't want to redirect the ...
3
votes
4answers
108 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?
0
votes
1answer
50 views

Searching a word from a specific dictionary file in sdcv(console version of Stardict offline dictionary)

I have recently installed sdcv(console version of Stardict offline dictionary) and have installed 5-6 dictionary files as shown here Whenever i search any word, using sdcv hello or sdcv cat , it ...
62
votes
12answers
21k views

How to grep a specific line _and_ the first line of a file?

Assuming a simple grep such as: $ psa aux | grep someApp 1000 11634 51.2 0.1 32824 9112 pts/1 SN+ 13:24 7:49 someApp This provides much information, but as the first line of the ps ...
2
votes
2answers
85 views

Extracting values from a file keyed by multiple keys

Consider a file with key=value pairs, and each key is optionally a concatenation of multiple keys. In other words, many keys can map to one value. The reason behind this is that each key is a ...
4
votes
2answers
373 views

Eject / safely remove vs umount

I'm using Ubuntu 12.04, and when I rigth click on a my flash drive icon (in the Unity right bar) I get two options that have me confused: eject and safely remove. The closer I came to answer was this ...
2
votes
4answers
100 views

Fastest way to read last line within pattern of multiple files with the same extension

I have in a directory /home/files/ some files that all have the same extension .txt. For example 1.txt 2.txt 3.txt 4.txt 5.txt test.txt These files are all the same in data format but the data are ...
33
votes
7answers
198k views

How do I zip/unzip on the unix command line?

How can I create and extract zip archives from the command line?
2
votes
2answers
605 views

Change a value in a config file, or add the setting if it doesn't exist?

When modifying config files from the command line, I often want to find the setting in the config file and modify that line if that setting exists. If that setting doesn't exist, I want to add it to ...
19
votes
3answers
11k views

How to Determine the Amount of RAM Slots In Use?

I forgot how many RAM modules are installed on my laptop. I do not want to unscrew it but want to look it up on the console. How do I gather this information?
9
votes
5answers
1k views

How do I remove spaces from shell variables?

I have done the following at command line: $ text="name with space" $ echo $text name with space I am trying to use tr -d ' ' to remove the spaces and have a result of: namewithspace I've tried ...
3
votes
1answer
72 views

bash runs out of memory

This question is a fork of this SO question. Here is the MCVE version: $ PS1='Parent-$ ' Parent-$ type seq seq is /usr/bin/seq Parent-$ bash $ PS1='Child-$ ' Child-$ for i in $(seq 1000000000); do ...
23
votes
2answers
16k views

How to remove a single line from history?

I'm working in Mac OSX, so I guess I'm using bash...? Sometimes I enter something that I don't want to be remembered in the history. How do I remove it?
1
vote
1answer
61 views

Is there any command in linux which will force linux machine to not shut-down

I have a very important process which is having a Queue, In Queue i'm storing important data and when if someone trap that process it must have to process the data which is there in the Queue after ...
3
votes
1answer
59 views
1
vote
1answer
31 views

How do I keep running a command in the same area of the console window? (“w”)

I'm looking at the output of w: ehryk@ArchHP ~> sudo w 14:12:37 up 4:08, 4 users, ...
1
vote
1answer
52 views

Can I check how much energy a USB device is consuming?

Is there any utility I could use to check how much energy a USB device is consuming, for a given time frame?
1
vote
1answer
48 views

Output Redirection

I am using the tee command to output the compilation errors of a program into a file along with the terminal. gcc hello.c | tee file.txt This is the command I have used. The compilation errors are ...
2
votes
0answers
42 views

How to access KVM guest console without password?

How can I configure a KVM guest running CentOS to allow passwordless console access from the hypervisor? I want to be able to use the following command to log straight in to the VM from the hypervisor ...
0
votes
1answer
93 views

ipmitool set idrac mode

I have a DELL server R610, on this server there is a RHEL 6.4 This server has an idrac entreprise. I would like to configure the idrac from command line, avoiding reboot. I read on the man page of ...
1
vote
1answer
96 views

How can I add applications to the lxpanel application launch bar via cli?

Is there a way on LXDE toolbar to change what applications are on the quick launch part via the terminal so that it can be put in a batch file to change on multiple clients?
2
votes
2answers
712 views

Bandwith monitoring in Linux

I just need to get how much bandwidth is used in 3 or 4 days. Do you have any application in the terminal to do it? I'd prefer if it didn't use SNMP. I found iptraf, wireshark, cacti, but they were ...
1
vote
2answers
47 views

env command shows 3 times same path

When I run env it shows 3 times /usr/bin under PATH. Same for every path under PATH title. For example - my scala bin directory shows 3 times. However, in my .bash_profile, it is written just one ...
12
votes
2answers
771 views

Ctrl+D for ending terminal line input

If I do $cat > file.txt text<Ctrl+D><Ctrl+D> Question1: If I don't press enter, why do I have to press Ctrl+D twice? If I do $cat > file.txt pa bam pshhh<Ctrl+Z> [2]+ ...
1
vote
1answer
72 views

What does this `xhost …` command do?

Please help me understand this line of command: xhost +SI:localuser:lightdm in reference to the answer in this post and also suggest if there's a better way and why that's needed. I couldn't make ...