The command-line is the interactive interface to your shell.
-6
votes
1answer
46 views
How to create new script , role like wc [on hold]
I would like to create a new .wc command , but I have no idea how to proceed.
Can you help me?
3
votes
2answers
43 views
How can a space-delimited list of words be folded into tabular columns that fit in the terminal's width
I would like to output a series of space-delimited words in a tabular format, filling line by line so that nothing exceeds the terminal's width but the available space is used optimally, like this:
+-...
1
vote
1answer
36 views
Fork Bomb: Why Piping Output Into Another Copy of Fork Bomb works if no Output is returned? [duplicate]
I understand the basic syntax of this famous fork bomb : ( ) { : | : & } ; : but I am currently struggling to understand the part of : | :, where one pipes the output of : to another :.
What I do ...
1
vote
0answers
9 views
How can I open a debugfs on a partition in an image file?
I am trying to open a debugfs on an image obtained from dd. I'm interested in the 3rd/5th partition.
Number Start End Size Type File system Flags
1 32256B ...
1
vote
3answers
26 views
Find all files, create CSV with one row per subdirectory and file names in collumns
I have a directory with subdirectories and files structured like this:
01/fileA
01/fileB
01/fileC
02/fileD
02/fileE
03/fileF
03/fileG
03/fileH
04/fileI
I'd like to get a CSV that looks like this:
...
1
vote
1answer
24 views
How to run the executable file to convert the extension of multiple files in Linux command line? [on hold]
I use (./executablescript filename ) to convert the file format. It works for a single file. But, If I need to do it for multiple files, I get the error message "multiple occurrences". How can I run ...
1
vote
1answer
14 views
find matching file and change dirname path
I need to find a very efficient way of moving a file of matching -mtime from one directory tree to another directory, maintaining the same subdirectory path where it doesn't exist yet.
eg. move /dirA/...
2
votes
2answers
49 views
How can I access a Vim process after closing its terminal on macOS?
This what I get when I run the ps command:
$ ps
PID TTY TIME CMD
14777 ttys000 0:00.25 -bash
19716 ttys000 0:00.15 vi templates/base.html
8240 ttys001 0:00.11 -bash
8284 ...
1
vote
2answers
48 views
Piping a non-constant amount of commands [on hold]
piping commands is fairly straightforward once the number of commands n is fixed.
For example (n=2)
echo Hello | grep llo
But let's say the number of commands may vary. It will only be known at the ...
1
vote
2answers
28 views
Raspbian: play video through HDMI from command-line
I have a raspberry 2. I installed raspbian OS (only terminal) on it. I plugged in a HDMI cable, but it seems that it's not working. When I try to run video(or something) in command line nothing ...
0
votes
1answer
54 views
Command works when copied and pasted but not in a bash script?
I'm trying to pass a windows command into a linux netcat shell and then read back the output.
So far I have:
cat <( printf 'ipconfig\n' )| nc -v 137.148.70.243 443
Which when copied and pasted ...
1
vote
2answers
30 views
Xterm “color query” doesn't print anything
I'm trying to programmatically query the background color of my terminal with
echo -ne "\e]11;?\a"
but the output appears blank. The issue arises using both Terminal.app and iTerm 3, in both Zsh and ...
3
votes
1answer
41 views
What Type Of Data does the Input File Contain?
I have a folder with more than 10000 text files. The files can be of two types:
Type1: called “DNA”
Format:
header information starting with “>”
Line 2 onwards contains only the following letters:...
0
votes
1answer
22 views
Change GTK theme from command line
I was able to change my GTK theme with lxappearance but would prefer to know the command (or multiple commands, if GTK2 and GTK3 themes need to be set separately).
At the moment, I'm on an Ubuntu ...
6
votes
0answers
39 views
Programmatically redirect audio output of specific program to file
I would like to redirect the audio output of a program to file, on the command line, like in
$ redirect-wrapper file.wav my-program
so that
I don't hear the output of the program, i.e. the output ...
0
votes
1answer
32 views
cat filename | cut -f2 | head -1 > newfile contains more characters than expected
When I run:
cat filename | cut -f3 | head -1
I get the following result:
apple
However when I save this to a file by using:
cat filename | cut -f3 | head -1 > newfile
I then open this using ...
0
votes
0answers
24 views
change Cinnamon hot corners via command line - gsettings
I am using Linux Mint 18 Cinnamon edition.
I am trying to change my hot corner settings via command line. I used dconf watch / to obtain which value to change - it appears that currently I have this ...
3
votes
4answers
97 views
Check logical volume mount point (command line)
With GNOME Disks utility, I can check whether a logical volume is mounted:
And where is it mounted:
How can I get this information from the command line? Having, for example, the logical volume UUID,...
-3
votes
2answers
60 views
How to write bash script to open vi and edit document?
I'd like to write a bash script that essentially automates this process:
vi filename.pdf
(open "filename.pdf" using vi)
:4,7d
(in vi command mode, delete lines 4-7)
O
(in vi command mode, tap ...
0
votes
1answer
17 views
subset files in a folder based on a list
I have a folder "all_images/" with more than 1000 image files named as "Image1.tif", "Image2.tif" and so on..
I have a text file "extract_images_list.txt" which is a list of images that I want to ...
2
votes
1answer
54 views
mispelled command in UNIX?
I don't remember a UNIX command that allowed you to remember how to write correctly a command.
Let's supose that the command that I say is called MISPELL
So running MISPELL will produce the ...
4
votes
0answers
15 views
VLC in background and display it only via HDMI
I run VLC player and It starts in my command line as well, how to run It in background and to output only via HDMI? Raspbian OS (Raspberry)
1
vote
1answer
19 views
copy files remotely on same path
I have thousands of csv files in some directories. Out of which I would like to copy one csv file to remote machine on same path, if remote machine doesn't have directory then it should create ...
8
votes
5answers
748 views
Reverse a hexadecimal number in bash
Is there a simple command to reverse an hexadecimal number?
For example, given the hexadecimal number:
030201
The output should be:
010203
Using the rev command, I get the following:
102030
...
1
vote
2answers
54 views
How to compose next command while previous is executing?
While working in bash (usually with git), what often happens to me is that I start some command and while that command is executing (which could take a while), I want to start composing the next ...
7
votes
3answers
263 views
How can I check to see if a process is stopped from the command-line?
I have the pid and I just stopped a program using
kill -stop PID
Now I want to continue it by doing
kill -cont PID
But only if it's already stopped. How would I check to see if it's stopped or ...
2
votes
3answers
160 views
How do I sort files into a sub-folder based on filename part?
These are the files in the directory:
Ford-Mustang-001.jpg
Ford-Mustang-002.jpg
Ford-Mustang-003.jpg
Chevy-Impala-001.jpg
Chevy-Impala-002.jpg
Chevy-Impala-003.jpg
I would like to sort these into ...
-1
votes
2answers
43 views
bash: Deleting directories not containing given strings
How can I delete directories using the bash that do not contain directories named wav or mp3? I use macOS Sierra.
find . -type d \! -exec test -e '{}/wav' \; -print finds the directories not ...
1
vote
1answer
32 views
Randomness test using rngtest
I have a binary sequence like
0011000111000111. I put this in a file
abc.txt. I want to test its randomness using rngtest.
I am getting as follows:
/Documents$ rngtest <abc.txt>
bash: syntax ...
-1
votes
1answer
16 views
shell script counting the lines that meets in range values
I have this :
S=`cat sales.txt`;
echo "$S" | cut -d: -f5 | grep -E '[0-9][0-9][0-9]' | wc -l
My Textfile : name:id:number:type:value
Tom:8:987654:A:67 //1
Dick:9:7651:B:83 ...
2
votes
1answer
31 views
Recommended Way To Associate Command With Environment?
Sometimes I find myself using software (which I don't have the permissions or patience to re-compile) which searches through my PATH looking for its dependencies at runtime, but these dependencies are ...
0
votes
2answers
27 views
Find & remove files that are uploaded through Cpanel x minutes ago, using SSH
I have a Cpanel login of remote system into which I have uploaded a number of folders and files scattered throughout the structure.
But I remember that I did this a few minutes ago, roughly x minutes ...
0
votes
0answers
30 views
gpg: error creating passphrase: Operation cancelled
I compiled gnupg-2.1.15 on CentOS6.5
Once compilation is done it's working fine on same host.
But if I move binaries and libraries to remote host and try to use gpg it's giving below error.
gpg: ...
2
votes
2answers
35 views
Tcpdump - counting outgoing and incoming UDP packets
Is it possible with tcpdump to count (for some set up time) the number of outgoing and incoming UDP packets?
I don't have much experience in tcpdump, so an advice how to do that would be very helpful....
1
vote
1answer
48 views
Is there a way to use the pound sign '#' as an alias?
Can the .bash_aliases file accept an alias that is of the form of alias #='./'
I've tried quotes and escaping the character too, but it doesn't seem to work.
0
votes
0answers
14 views
Tell fswatch to clear screen before running command?
I have the following ruby script, foo, that I'm watching with fswatch:
#!/usr/bin/env ruby
puts "hello world!"
on the command line the output looks like:
➜ ~/w/s/g/m/todo master ✗ fswatch bin/* | ...
1
vote
2answers
47 views
Why does no command advise the user to consult a man page on incorrect usage? [closed]
I recently gave a workshop on Linux tools and have been telling students to consult the man pages of commands should they run into errors.
However, I noticed that the command itself never returns a ...
0
votes
0answers
16 views
Install Perl on an embedded Linux
I have a device running:
Linux version 3.2.0 (primax@primax-vm) (gcc version 4.7.3 20130226 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.03-20130313 - Linaro GCC 2013.03) ) #1 Tue Sep 8 14:42:47 ...
0
votes
0answers
32 views
Find directory containing file; execute command in that dir; then delete files
I want to find all directories (recursively) which contain .cue files, execute a command in that directory, then delete all files in that directory with the same prefix as the .cue file.
find . -name ...
2
votes
1answer
17 views
Create shorcuts in a terminal to navigate between folders [duplicate]
I am looking a way to create shortcuts for the cd command. My goal is to go quickly to distant folders. I have a new (big) drive which is not in my /home folder (but in /media/user/xxX/yyy/) and I ...
3
votes
0answers
16 views
Mount a Thunar/Nautilus/Nemo gvfs bookmark using command line
I have some bookmark that use smb/sftp through gvfs, how to mount them using command line?
when I click them (mount using mouse click), it shows on /run/media/myuser/BookmarkName
So, is there any ...
1
vote
0answers
31 views
Start standalone full-screen google chrome apps by command line
I can run google-chrome app standalone this way:
google-chrome --app="https://calendar.google.com/calendar/render#main_7"
but cannot open calendar in maximized window. A script is running without ...
1
vote
1answer
63 views
How to install and set new themes in KDE plasma via terminal
I've been having some issues with the breeze theme while starting plasma and I want to know if there is a way to install a another plasma theme via the terminal and set that to default.
I'm using arch ...
1
vote
1answer
60 views
One-liner to insert a new line of text (literally a regex, thus many to be escaped characters) in a configuration file before a specific string?
I do wish to modify a Mac OS X sandbox file via a one-line (copy and paste) command, by inserting a new line — containing a regex — after a line that contains a specific string (also being ...
1
vote
0answers
24 views
Space usage not correct [duplicate]
When I run
df -H
I can see that the root / is using 100% of the space:
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 423G 423G 0 100% /
udev 2.0G 8.2k 2.0G 1% ...
0
votes
1answer
45 views
“ip” command of iproute2 package
In Linux I can do: ip -4 address show or (more verbosely): ip -family inet address show to retrieve information on IP addressing. This command returns:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ...
1
vote
2answers
64 views
Why am I unable to do a “sudo apt-get update”?
I recently started using linux mint. I am trying to execute the following command in my terminal sudo apt-get update . But I always get this output:
How can I solve this issue?
...
Ign:10 http://...
-1
votes
0answers
18 views
Excluding users from an insert command
I have an insert command that runs fine:
mysql $i -Nnrse "insert into menuacc values('NULL','$i','$menu_code','N','N','N','N','N') where name = ABC;
but I am trying to exclude two users from this ...
2
votes
3answers
73 views
Batch rename folders with a single bash command
I have folders setup like this:
/path/to/directory/SLUG_1/SLUG_1 - SLUG_2 - SLUG_3
SLUG_2 is a year, and it may have a letter after the year, like "1994" or "2003a".
I would like to rename those ...
1
vote
1answer
29 views
Suppress printing of total line with ls -l
ls -l adds a total line (for total number of blocks) at the top of its output. Is there a direct way to suppress this line from the output? I know I can pipe the output into another command to delete ...