Questions tagged [command-line]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

Launch Openbox actions through script or cli

I was wondering if it is possible to run openbox actions, like the ones that can be found on rc.xml like MoveResizeTo , through a console command so I can launch it from terminal or inside a bash ...
-2
votes
2answers
51 views

Command du -xh / | grep -P “G\t” explained?

Interested in switch -P what does it do? And "G\t" pattern explanation? Please do not explain du -xh or basics of command grep. du -xh / | grep -P "G\t" 5.1G /var/oracle/XE/datafile 5.1G /var/...
0
votes
1answer
38 views

Is it possible to put the output of one command into the middle of another [duplicate]

I am asking if there is a way to automatically put the output of a command into the middle of another. multimon-ng outputs: ZCZC-WXR-TOR-029037+0030-1051700-KEAX/NWS and i want that output to get ...
38
votes
4answers
30k views

IP to Country console command

Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?
28
votes
6answers
15k views

Check ping statistics without stopping

Is there a way to tell ping to show its usual termination statistics without stopping the execution? For instance, I'd like to quickly view: --- 8.8.8.8 ping statistics --- 2410 packets transmitted, ...
22
votes
5answers
44k views

How to show an environment variable's current value?

When I check on my system's environment, a lot of environmental variables will pop up. How can I just search for a particular variable? A book I'm reading says: Sometimes the number of variables ...
1
vote
1answer
63 views

How to properly solve “git-gui: command not found” on Arch Linux?

The Arch Linux git package installs git-gui under /usr/lib/git-core/. This means git-gui cannot be launched directly from the terminal without specifying the full path: $ git-gui bash: git-gui: ...
79
votes
11answers
179k views

Generate random numbers in specific range

After googling a bit I couldn't find a simple way to use a shell command to generate a random decimal integer number included in a specific range, that is between a minimum and a maximum. I read ...
2
votes
0answers
26 views

extract last 5 mins of information from the log file

system date format: Thu Jun 13 12:55:18 EDT 2019 My log format: 193.118.26.141 - - [01/May/2019:00:08:49 -0400] "GET / HTTP/1.1" 200 27 can someone please help me, how to get last 5 minutes of ...
0
votes
1answer
2k views

Passing inline arguments to shell script being executed on HDFS

I am running a shell script stored on HDFS (so that it can be recognized by my oozie workflow). to run this script I am using hadoop fs -cat script.sh |exec sh However I need to pass inline ...
0
votes
1answer
81 views

Pass command-line result as an argument to next command

Trying to insert output from this: kubectl get pods | grep -Eo '^[^ ]+' | grep portal Into this: kubectl exec -it <here> portal bash Tried: kubectl exec -it `kubectl get pods | grep -Eo '^[^...
12
votes
5answers
50k views

How to print the percentage of disk use from `df -hl`

I know that df -hl outputs a list of all my partitions with its size, usage as a percentage, and space available. If I wanted to output just the size and usage as a percentage of sda2 and sda3, for ...
0
votes
1answer
32 views

Dig: connection timed out; no servers could be reached. But ping works?

When I try to run the dig command against either my servers IP or nameserver I get an error: root@kali2:/etc# dig q-type=soa @192.168.100.10 ; <<>> DiG 9.11.4-P2-3-Debian <<>&...
0
votes
3answers
2k views

Copying multiple types of files in one command

I want to copy several files from one directory to another, with different extensions So I would write something like: cp -r dir1/*.gif dir2 But I also want to copy all .jpg files in the same ...
0
votes
0answers
32 views

Conditional deleting of duplicate files

I have seen similar questions, but it seems my desired result is not covered in the answers. I want to delete duplicates only if files share the same name. Something like: rdfind -deleteduplicates ...
1
vote
2answers
23 views

How to replace all values (all NAs) in a column with numeric part of the file name?

I have multiple (22) files that are named like this: chr1.out, chr2.out...,chr22.out each of those files has 46 columns and multiple lines The first 6 columns and 6 rows in one of those files looks ...
4
votes
3answers
21k views

Convert binary encoding that head and Notepad can read to UTF-8

I have a CSV file which is in binary character set but I have to convert to UTF-8 to process in HDFS (Hadoop). I have used the below command to check characterset. file -bi filename.csv Output : ...
12
votes
8answers
13k views

Use xdg-open to open a url with a new process

I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of xdg-open. I ...
37
votes
9answers
31k views

Easy way to paste command line output to paste bin services?

Are there any command line tools on Linux that allow you to post output from commands or text files directly to a sharing service such as pastebin.com?
1
vote
3answers
246 views

Why does a file move/copy function only move one file at a time when using the “*” wildcard?

function mv1 { mv -n "$1" "targetdir" -v |wc -l ;} mv1 *.png It does only move the first .png file it finds, not all of them. How can I make the command apply to all files that match the wildcards?
51
votes
5answers
105k views

How do I remove all sub-directories from within a directory?

This question is kind of a phase II to the first question I posted at here I have a directory that contains a bunch of sub-directories, .zip files, and other random files not contained within a sub-...
-4
votes
1answer
52 views

Explain how these commands with pipe and dash work? [closed]

How (and why) do these commands with a pipe and a dash work exactly? pacman -Qqdt | sudo pacman -Rns -
-6
votes
1answer
69 views

. (Kali) I’m stuck [closed]

I downloaded the latest version on my 2012 mac, and flashed it onto a usb with etcher, it booted just fine, and everything seemed okay, but then I went to proxy and a popup appeared: Alert! Network ...
0
votes
2answers
65 views

Progress bar to display progress based on number of files found/completed in for loop?

Is there a progress bar that can show visually completed progress based on the number of detected files found and completed in a for loop like the one below? mkdir -p hflip; for i in *.mp4; do ffmpeg ...
36
votes
6answers
35k views

How do I find the window dimensions and position accurately including decorations?

I've been trying to figure out the size of a window for use in a small script. My current technique is using wmctrl -lG to find out the dimensions. However, the problem is this: The x and y figures ...
0
votes
3answers
95 views

Linux command to find and delete Files which contain a given text

Is there a terminal command to delete files which contain a given text? Let's say I have three files and some of them contains the text "extract($_REQUEST)": file-1.php: This file contains the text "...
0
votes
1answer
29 views

Can't seem to concatenate multiple files in different directories

I'm trying to concatenate multiple files together that are in different directories using the following command: ~$ find . -name ‘*.text’ -exec cat {} >> combined.text \; However it doesn't ...
2
votes
1answer
42 views

Creating new elements with xmlstarlet

I have been trying to to add new elements to an XML file. Original file: <levela> <levelb> </levelb> </levela> I'm trying to get the following result: <levela> &...
0
votes
1answer
65 views

how to add additional command-line usage scenarios to script?

how can one make this script work with both input usage scenarios below? #1 ./script.sh #2 ./script.sh input.file contents of script.sh for i in *.mp4; do ffmpeg -i "$i" "${i%.*}.mp4 ...
0
votes
0answers
18 views

Font not showing when I run fc-list[arch]

[wasiim@wasiim-PC fonts]$ ls adobe-source-code-pro encodings noto ttf-linux-libertine util cantarell gsfonts TTF ttf-tahoma [wasiim@wasiim-PC fonts]$ ls TTF fonts.dir fonts....
4
votes
2answers
379 views

What setting controls moving the cursor on the command line?

On some Unix systems, I can type Ctrl-A or Ctrl-E to move to the beginning or end of the line. On some Unix systems I can not and it just prints ^A or ^E, etc. What controls whether this keystoke ...
0
votes
1answer
32 views

How to identify available environmental variables for applications?

On Linux, the crontab editor can be configured to open with nano using the following command: $ EDITOR=nano crontab -e This "EDITOR" env is mentioned in the crontab manual, but is there a way to ...
15
votes
2answers
20k views

Pausing terminal output

I have a command which outputs lots of data (say, strace with lots of syscalls, running for a few minutes). Is there any option (e.g. command wrapper or something similar) that would allow me to ...
15
votes
2answers
10k views

What is the difference between “eval” and “source /dev/stdin”?

Between the following alternatives... with eval. comd="ls" eval "$comd" with source /dev/stdin printf "ls" | source /dev/stdin with source /dev/stdin and ( ) or { } ( printf "ls" ) | source /dev/...
0
votes
1answer
22 views

Redirect output to file when there is additional prompt

I'd like to save the output from running a specific command on the command line. However, after running the command, I am prompted to type in the name of my account to confirm that I would indeed like ...
2
votes
3answers
78 views

On a Mac, how can I list contents of a non-current directory without showing backup files (ending with ~), preferably with BSD command ls?

My system: OS: MacOS / Mac OS X (Mojave 10.14.5) OS core: Darwin (18.6.0) Kernel: Darwin Kernel / XNU (18.6.0 / xnu-4903.261.4~2/RELEASE_X86_64) ls: version unknown, but man ls gives a page from the ...
0
votes
1answer
23 views

Locating a process ID by CPU usage (Ubuntu) using AWK

I have a command that I run to try and list PID's and their CPU usage. I am using ps -ef. Is there a (better) way to do this using top? Also, I had a question about my awk statement. My variable $...
2
votes
1answer
1k views

“ndd” equivalent of “ethtool” on Solaris

I've to restore a large file from a NAS backup on Solaris 10 ZFS. I'm using this following command: rsync -av user@xxx.xxx.xxx.xxx:from/NAS/files/system to/solaris/files/system And I've got this ...
10
votes
5answers
17k views

How to apply dos2unix recursively to all the contents of a folder?

Is there a way to apply the dos2unix command so that it runs against all of the files in a folder and it's subfolders? man dos2unix doesn't show any -r or similar options that would make this ...
1
vote
3answers
1k views

How can we generate the session token in aws

i have aws access key and secret key with me. i wanted session token to be updated in aws credential file (~/.aws/credentials), how will i get it? I want them to be generated in command line.
1
vote
1answer
224 views

/bin/sh: /usr/bin/wkhtmltopdf: not found

I installed /bin/sh: wkhtmltopdf /usr/bin/ directory. However when I try to run the program by entering /usr/bin/wkhtmltopdf to shell I receive an error /bin/sh: /usr/bin/wkhtmltopdf: not found. It ...
7
votes
4answers
3k views

Screenshot of non active window

How to take a screen shot of non active window? If I have 2 windows, I want to capture the screenshot of the one which is running in the background.
0
votes
2answers
136 views

How do I turn on terminal output in CentOS 6.8?

When I run the command service httpd restart the service restarts but there is no feedback to tell me that the server restarted successfully. Previous servers output a response like shutting down ...
2
votes
3answers
145 views

How to convert a 3 column csv file into a table (or matrix)

I have an CSV input file format like this, with a nucleotide sequence in field 1, text in field 2, and an integer in field 4: ATGC,CD3,56 ATGC,CD4,67 ATGC,IgD,126 ATGC,IgM,127 AGTC,CD3,67 AGTC,CD4,78 ...
1
vote
1answer
58 views

Keep all line breaks except the last one using awk

How do I modify this line below to capture the content between two lines without the trailing line break? interesting="$(awk "NR >= $first_line && NR <= $second_line" $file_path | ...
1
vote
0answers
105 views

Browse the internet from the command line

I know there are command-line web browsers like w3m lynx etc. But I am looking for a simpler tool to just print search queries. Somewhat like curl does, but more nicely formatted. Like if I run https:...
3
votes
2answers
2k views

How to get the exit code of commands started by find?

I am using "find" in a Travis-CI to check a particular file type with a program. (To be exact, it is a shellcheck check.) However, when using find the exit codes of the command(s)/subshells executed ...
50
votes
7answers
34k views

Find only destination of symlink

For use in a shell-script, I'm looking for a commandline-way to get the destination of a symbolic link. The closest I've come so far is stat -N src, which outputs src -> dst. Of course I could ...
0
votes
1answer
595 views

cannot find Trash folder! Ubuntu 18.04

I am running a preinstalled version of ubuntu 18.04 but cannot find Trash folder. The typical places don't have the folder. ~/.local/share/Trash <-- does not exist /root/..../Trash <-- does ...
1
vote
1answer
2k views

How to use ClamAV to scan the memory

How can I only scan the computer RAM for viruses using the ClamAV command clamscan? I already tried, because I found it on ClamWin forum: clamscan --memory But it seems, that the Linux version does ...