Questions tagged [command-line]

This tag is for questions that are about using the command-line interface (CLI), including the use of standard command-line tools and shell commands. However, for questions that are specific to each shell (like Bash, ZSH etc.), use the tag of that particular shell as well.

Filter by
Sorted by
Tagged with
4 votes
1 answer
817 views

Problem manipulating text using grep

I want to search for a line that contains log4j and take 7 lines before and 3 lines after the match. grep -B7 -A3 "log4j" web.xml After that I want to add comment tags before this paragraph and ...
moata_u's user avatar
  • 5,413
4 votes
1 answer
194 views

How to install "bought" softwares from the command line? [duplicate]

I love doing things the command-line way and need to install some proprietary softwares that are available free of cost but have to be "bought" from the software center: How do I install such ...
jobin's user avatar
  • 27.7k
4 votes
4 answers
17k views

"/proc/partitions not found" error is showing up

I am configuring a webserver in Ubuntu 10.04. More particularly I am installing DataStax OpsCenter. Unfortunately, the logs are spammed with this error: ERROR [pool-3-thread-7] 2013-02-15 22:04:34,...
Linas's user avatar
  • 143
4 votes
1 answer
897 views

Terminal TTY Ctrl-Alt-F# not working, only prints junk characters

I'm not sure what I pressed to mess this up. I was on tty1, but it doesn't look like I'm on tty1 anymore. When I press any key on the terminal it just prints weird letters. Pressing Ctrl-Alt-F1 ...
Sepero's user avatar
  • 4,557
4 votes
4 answers
3k views

How to start/stop downloads in Azureus (Vuze) via terminal?

I need to stop/start download through shell script in Azureus(Vuze). I know there is CLI and I can invoke it as java -jar Azureus2-XXX.jar --ui=console The ? will show a list of commands I can use. ...
Rahul Virpara's user avatar
3 votes
4 answers
4k views

What happens if we do rm -rf ../**? Can we restore the data?

I did something like: $ cd /A/B/ $ rm -rf ./* $ rm -rf ../** Due to network issues my system disconnected from Ubuntu. When I came back there were no files or folders in the /A folder.
xxz's user avatar
  • 39
3 votes
5 answers
8k views

How to get the location of a program in Ubuntu terminal?

How to get the location of a program in Ubuntu? For example I have Oracle, how to get the folder racine (location) of Oracle?
SalamBoy's user avatar
3 votes
6 answers
10k views

Use bash to extract number from between square brackets

My file looks like this: [581]((((((((501:0.00024264,451:0.00024264):0.000316197,310:0.000558837):0.00857295,((589:0.000409158,538:0.000409158):0.000658084,207:0.00106724 ):0.00806454):0.0429702,(((...
user3069326's user avatar
3 votes
4 answers
25k views

How to uninstall softmaker freeoffice

I downloaded FreeOffice from here. Now I am trying to uninstall it by doing this command: sudo dpkg -r softmaker-office And it isn't working.
6warrior's user avatar
  • 127
3 votes
4 answers
64k views

permission denied while making a file without asking for password

I'm trying to create a file using cat > list but each time it shows me "Permission denied". xyz@jaishreeram:/home$ sudo cat > list bash: l: Permission denied xyz@jaishreeram:/home$ sudo cat >...
abhinay's user avatar
  • 71
3 votes
3 answers
138k views

cd.. and cd- commands not found - how do I use the cd command?

I am using Precise pangolin. As far as I know, commands like cd.. or cd- are used to browse through folders in the terminal. But whenever I enter one of this commands, it gives an error saying ...
Della's user avatar
  • 505
3 votes
4 answers
2k views

Is there any way at the bash command line to compute multiplication and division so that the first 3 digits after the period appear?

I currently use the following to compute the following at the bash command line with commas every three digits: printf "%'3.f\n" $(((29246636)*4096)) 119,794,221,056 The equation needs to ...
Stephen Elliott's user avatar
3 votes
3 answers
3k views

How do I suppress GtkDialog warnings in zenity and yad using Bash redirection in a script?

I'm trying to suppress GtkDialog warnings in zenity and yad: $ zenity --error --text hello Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged. Error redirection and ...
WinEunuuchs2Unix's user avatar
3 votes
4 answers
2k views

Automate counting the number of occurrences

I want to know that how many times 'ABCD'(file A) comes in DB (file B). Likewise I want to know about every singe line present in file A against DB. I need an automated command which can ease my work ...
Rhea's user avatar
  • 571
3 votes
5 answers
2k views

Extract part of a line upto a particular string

Let us assume I have a file with lines like: /java/jdkxx/jvm_jdk/bin/opt /java/jre/jre_jvm/bin/opt /foo/bar/bin/other/stuff/here Is there a way I can extract part of the lines upto bin. I mean, ...
Raja G's user avatar
  • 102k
3 votes
3 answers
1k views

shell script to remove files didn't work

I want to delete multiple images having resolution less then 228x228. For that, I wrote this shell script: #!/bin/bash for i in $( ls ); do if [$(identify -format "%w" $i) < 228] && ...
singrium's user avatar
  • 6,890
3 votes
2 answers
9k views

pipe stdout to zenity notification

I would like to pipe the stdout of shutdown -P +60 to zenity --notification. But this does not work: sudo shutdown -P +60 | zenity --notification
user avatar
3 votes
5 answers
4k views

How do I make the shell to recognize the file names returned by a `ls -A` command, and these names contain spaces?

This is the part of the script I am using to rename the files returned by ls -A: for FILE in `ls -A` do ext=${FILE##*.} NUM=$(($NUM+1)) NEWFILE=`echo $2_$NUM.$ext | sed 's/ /_/...
Patterson's user avatar
  • 1,360
3 votes
2 answers
88k views

Bash return permission denied error when I redirect the output of ls to a file [duplicate]

I'm currently studying shell commands, one of the exercises consists in creating a structure with various directories and subdirectories. I wrote ls -laR > hello, it was supposed to create a text ...
sUnTECH789's user avatar
3 votes
3 answers
174 views

Why do bad requests take so long?

I noticed this is other OSes as well, but most visibly in Ubuntu Linux. Whenever a good request is made, it is computed practically instantly. However, whenever a bad request is made (a bad password, ...
Paul's user avatar
  • 1,165
3 votes
3 answers
15k views

Command not found $ (dollar sign)

Any command that starts with $ returns command not found How can I fix this? I am using 16.10 Ubuntu.
keelay's user avatar
  • 55
3 votes
3 answers
24k views

cron error: bad username

I've basically re-written the terminal output instead of appending a series of edits to this question: root@doge:/etc/cron.d# root@doge:/etc/cron.d# tail /var/log/syslog Dec 21 11:35:01 doge cron[...
Thufir's user avatar
  • 4,551
3 votes
4 answers
26k views

how to use sed to replace from last 3 characters from string

I have the issue to extract the x amount of characters from string and i have the difficulty enlarging the capability of the expression. I have tried to use the sed command. If i have the string ...
Vitalik Jimbei's user avatar
3 votes
3 answers
5k views

Which terminal does Ubuntu use?

I've recently moved to Linux Mint, but I've always preferred the Ubuntu terminal over the xterm that is used in XFCE and KDE, can anyone tell me what it is called or where I can download it? Thanks!
Bajinga's user avatar
  • 45
3 votes
4 answers
1k views

Which respository does xvnc4viewer belong to?

I am using Ubuntu 20.04 and have a list of package names of which I want to check whether it is part of the default Ubuntu repository. So far I am iterating over the list an check with the following ...
Andi's user avatar
  • 95
3 votes
5 answers
5k views

A new command combining apt update && apt upgrade in 18.04 or some later beta?

If I'm not wrong there's a new command unifying apt update && apt upgrade in 18.04 or some later beta, with some argument -u or -d. Am I correct, or there is something similar?
user avatar
3 votes
5 answers
2k views

Join two files, adding values in certain columns

How can I add another 2 values after matching the values from 2 columns in another file just like VLOOKUP? Sample below. Value in column 6 & 7 from file1, when matched with column 1 & 2 from ...
pawana's user avatar
  • 115
3 votes
4 answers
5k views

How to remove only the last forward slash in the field?

I have a json file where I need to remove the last forward slashes only. See the example: {"url":"http://example.com/vary/file/","originalUrl":"http://example.com/vary/file/","applications":[{.........
Jaffer Wilson's user avatar
3 votes
5 answers
3k views

Is there any command in Linux which does not make a system call? [closed]

I was reading about system calls and I got a doubt whether any command runs without making even a single system call. If not then what is the command with minimum number of system calls? I used strace ...
identicon's user avatar
  • 116
3 votes
3 answers
1k views

How to insert an ascii character in a line position?

I would like to edit a list of MACs in bl:ab:la:bl:ab:la format >> in to blab.labl.abla format. Each MAC is in a line. I'm new in the use of AWK or SED but I'm almost sure that it can be ...
RRR CCC's user avatar
  • 113
3 votes
4 answers
1k views

Is there any way I can search in a file for Uptime that is greater than 100 days?

Is there any way I can search in a file for Uptime that is greater than 100 days via Linux Bash commands? For example, file1 contains: Uptime is 172 days Uptime is 562 days Uptime is 30 days ...
Noob's user avatar
  • 31
3 votes
3 answers
846 views

Bash script not recording

So, here i am, playing with some bash scripts, and there is something that doesn't work: #!/bin/bash script -c \ sudo apt-get update && sudo apt-get upgrade && exit echo "(Not ...
macacomen98's user avatar
3 votes
1 answer
17k views

Bashscript making a variable equal a command. error command not found

Hi i keep getting the error ./imagehash.sh: line 2: =: command not found When i know that i set the $CMD variable correctly (i tried the command outside the bash script and it worked just fine) ...
octo-carrot's user avatar
3 votes
2 answers
1k views

What is the difference in running script with ./

What is the difference between running the script by calling directly its name and calling the script by adding a with prefix of './' . I can't find any difference in run time.
Vishnudev K's user avatar
  • 2,726
3 votes
2 answers
892 views

I need regex(7)'s manual, but man command shows regex(3)'s manual

I understand there are many manuals (which are displayed by man command) in Ubuntu that has same names and are distinguished by a number. For example there is regex(3) and regex(7). If I type man ...
PHP Learner's user avatar
  • 2,788
3 votes
7 answers
17k views

How to select and print IP address from a set of strings?

I have a sentence whic contains an IP address. For example, This sentence contains an ip number 1.2.3.4 and port number 50, i want to print the IP address only. From the above sentence, I want to ...
Anandu M Das's user avatar
  • 2,233
3 votes
3 answers
6k views

What are the common file extensions in Ubuntu?

Knowing file extensions really helps to understand what a program is doing or using. What are some common one's and how do I extract them?
wojox's user avatar
  • 11.4k
3 votes
3 answers
525 views

Remove apostrophe from multiple filenames

I'm new with Linux and I have the following problem. I have several different filenames like: 'Name1.mp4' 'Name2.mp4' ... I would like to have the apostrophe ' removed from the filenames. Meaning, in ...
Ralf Hütter's user avatar
3 votes
3 answers
2k views

Which character to escape for this to work in ~/.bashrc

I want to add this iostat command to my .bashrc and create an alias for it: iostat -xk 2 $(findmnt -T ~ | awk 'END {print $2}') I'm adding this to my .bashrc: alias ios='iostat -xk 2 $(findmnt -T ~ | ...
assilmanss's user avatar
3 votes
3 answers
9k views

How do I make an html file with text in it in a separate directory from the one I'm in, all in one command?

Is it possible to create an html file with some text already in it, (I'll just use my name as an example) in a directory separate to the one you're in, all in one command? I'm very new to Ubuntu and ...
Caleb Wagner's user avatar
3 votes
2 answers
349 views

Use read line to iterate over variables

I have the following files: $ ls *.png | egrep -i "am|pm" output-0 11.42.30 AM.png output-0 5.10.12 PM.png .... I want to remove them but get this error: $ ls *.png | egrep -i "am|pm" | while read ...
user10726006's user avatar
3 votes
2 answers
6k views

How do I find which user executes the script when is used sudo?

What I want is to find the name of the user that runs bash script, when this script is executed by sudo. The only possible way, that I know, is to parse the output of who -m (who am i) in this way: ...
pa4080's user avatar
  • 29.9k
3 votes
2 answers
6k views

Remove a users right to use sudo [duplicate]

As an administrator, how can remove a users rights to use SUDO. Is there a simple command to do this?
fantamoja's user avatar
  • 143
3 votes
3 answers
18k views

How to count number of process instances with bash?

Writing ps aux | awk '{print $11}' Gives me all the process instances, but how do I count them, is there a command that does that?
user avatar
3 votes
5 answers
3k views

How do I transpose a row to a column in a tab-delimited file?

I have a tab-delimited file with a number and the names belonging to the same number on the same row. The number and names are separated by a tab. The names are linked with each other by 2 underscores ...
Annemieke Smet's user avatar
3 votes
4 answers
57k views

How to uninstall/install youtube-dl by using terminal

I installed YouTube-dl through Ubuntu Software Center, but now mine isn't working. So I can not able to Update and Install youtube-dl. I tried this: $ sudo add-apt-repository ppa:nilarimogard/...
Madhav Nikam's user avatar
  • 2,907
3 votes
4 answers
3k views

Add to path only sh file not a dir

I have a bin folder with a bunch of sh files. For example "server-run.sh", "server-stop.sh", "server-do-something.sh". And I want to run file "server-stop.sh" from anywhere. I could add this bin ...
Moses's user avatar
  • 155
3 votes
5 answers
757 views

How can i fit 2 commands in 1 terminal shortcut

10 latest updates and drivers and I need to run a game called unreal tournament, but in terminal it requires 2 commands The first one is to mount into the folder: cd /usr/local/games/ut2004/ and ...
Nick Bailuc's user avatar
  • 3,325
3 votes
4 answers
9k views

Handle Doc/Docx Templates on a headless server to produce PDFs preferably without using OpenOffice.org

On a production web server I have to produce letters based on a template I got in MS-Word binary format. I use PHP and for the search and replace task I found PHPWord, which can handle Docx files, so ...
luxifer's user avatar
  • 53

1
119 120
121
122 123
457