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

learn more… | top users | synonyms (1)

1
vote
2answers
20 views

linux bash if statement inside for loop [duplicate]

I am attempting to iterate through 1-30, say hello #number for each except for number 10. This is what I have which is not working for i in {1..30}; do if [i != 10]; then echo "hello $i"; fi; done ...
3
votes
1answer
28 views

How do file managers split off opened programs?

I'm challenging myself for the next few weeks to use a terminal emulator as my main file manager. I've run into a question: how do I open a file (e.g. an Inkscape .svg) in it's GUI program from the ...
2
votes
1answer
46 views

How do I turn entire stdin into a command line argument verbatim?

Attempt 1 xargs -I '{}' -0 -n 1 myprogram --arg '{}' --other-options But that does not preserve zero bytes. Also the program may run multiple times. But instead of failing in case of zero byte ...
1
vote
1answer
42 views

How to prevent bash from transforming arguments?

I am trying to use an argument of the script to find other files. The problem is that when i give the script the argument x.* in the command line, it is transformed into x.sh. Any ideas how i can get ...
4
votes
2answers
105 views

Why does ping run forever by default in Linux? [closed]

What was the rationale for the design decision to make ping's default behavior to ping forever? For example, the following basic usage will ping address 127.0.0.1 forever: $ ping 127.0.0.1 ...
0
votes
1answer
31 views

APT repositories on Android

I am using a terminal emulator on Android called "Termux". It comes with the APT command installed. However, the repository is very limited. What I want to do, is to see if larger repositories like ...
1
vote
1answer
53 views

Updating a git variable in the Shell prompt on every command

I am running TCSH and I would like to update my prompt every time I run a command. I think can currently do that via backticks. set tmpstr = `git status --untracked-files=no --porcelain` set ...
5
votes
5answers
546 views

Run same command with different parameters

I've a not really permissive program to work with. Unfortunately, this program doesn't just allow the following "command -a -b -c" or "command -abc" So I've to always type the following command ...
0
votes
1answer
22 views

What the long option “ --debug” suppose to do in bash?

GNU bash, version 4.3.42(2)-release-(i686-pc-msys) Usage: bash [GNU long option] [option] ... bash [GNU long option] [option] script-file ... GNU long options: --debug ...
2
votes
1answer
40 views

How to quickly cd to a command's directory after used the 'which' or 'type' [duplicate]

I want to cd to the directory of go's bin file: $ type go go is /c/tools/go/bin/go How can I quickly cd to this directory in bash ?
0
votes
2answers
34 views

Is it possible to see errors when executing a script inside a script?

I have the files my1.sh and my2.sh. my1.sh: .... do something ./my2.sh my2.sh: .... do something else Now my problem is that if any command (like or example a ntfsclone) fails in my2.sh I get ...
0
votes
2answers
24 views

return value of command not displayed in script

If I execute the below rsync command in command-line , I am getting the proper return status /usr/bin/rsync -azv -p /home/zaman x11server:/home/zamanr &> rsyncjob/output."$datetime" echo $? ...
1
vote
1answer
45 views

shell command cd !$ [duplicate]

I looked at this question and googled, but can't find a definitive answer. What does !$ do when typed into terminal? I typed mkdir /path/to/dir cd !$ Which brought me to /path/to/dir but I still ...
1
vote
2answers
50 views

what condition we need to use “.” in command line? [duplicate]

a question - in some case, I saw command line like this . ./test.sh I'm curious why use "." before "./test.sh" what condition we have to use "." before a command?
0
votes
1answer
33 views

Create command line variables with PATH

As I am more of a web guy, i need a little help with this one, so I will explain what I am trying to do before I ask. I am creating batch script that will: GET request from an external server (json ...
0
votes
1answer
45 views

How to count the number of files in current directory that contain a specific phrase? [duplicate]

I want to count number of files in current directory that contain the phrase "HW". I tried ls -l | grep HW | wc -l
1
vote
1answer
45 views

How to make the prompt beep with every key press/character printed?

You know how hollywood movies depict hacking scenes with fast yet scrolling CLI technobabble in this fashion : https://www.youtube.com/watch?v=-jkj60TUWaE I want to know how to modify linux to make ...
0
votes
4answers
79 views

Flattening complex folder structures with duplicate file names

I have a folder with a complicated folder structure: ├── folder1 │ ├── 0001.jpg │ └── 0002.jpg ├── folder2 │ ├── 0001.jpg │ └── 0002.jpg ├── folder3 │ └── folder4 │ ├── 0001.jpg │ ...
3
votes
1answer
90 views

Set default shell as bash for users not in /etc/passwd

On my company's Ubuntu 15.10 desktop system, I log in via Active Directory using some magic based upon PBIS. Thus, my user account is not listed in /etc/passwd even though I have a home directory ...
0
votes
1answer
26 views

How can i list all stopped services in the order that they were stopped

I have a Debian server on which there are certain stopped services. I would like to know how can i list all the services in the order that they were stopped. Also would like to get the time when they ...
0
votes
0answers
52 views

Flattening folder structure with duplicate file names [closed]

I have a folder with a complicated folder structure: ├── folder1 │ ├── 0001.jpg │ └── 0002.jpg ├── folder2 │ ├── 0001.jpg │ └── 0002.jpg ├── folder3 │ └── folder4 │ ├── 0001.jpg │ ...
4
votes
2answers
68 views

How to modify files on Unix to avoid file purging policy?

We have a policy on our cluster that any files not modified or accessed within 30 days will be deleted. I have a project running and I want to keep all files until I finish it, would it be possible to ...
1
vote
1answer
33 views

Difference between “-” and “--” prefixed command line parameters? [duplicate]

Scripts on command line offer a wide range of parameters types. Often parameters can be passed to the script via "--[parameter]" or "-[parameter]". But what is the difference? Why do some parameters ...
0
votes
1answer
32 views

Debian: “update-command-not-found” IOError: Not a gzipped file

I run a random command in terminal and got this response: Could not find the database of available applications, run update-command-not-found as root to fix this Naturally, I run ...
0
votes
1answer
49 views

How to create a dynamic greeting?

Recently made the switch to Linux/command line, and I'm having trouble creating a dynamic greeting for terminal out of a list of predetermined possibilities. I tried the following, but it appears as ...
10
votes
4answers
816 views

Why doesn't echo called as /bin/sh -c echo foo output anything?

For example, while this works: $ echo foo foo This doesn't: $ /bin/sh -c echo foo Whereas this does: $ /bin/sh -c 'echo foo; echo bar' foo bar Is there an explanation?
0
votes
1answer
26 views

Pattern highlighting command [duplicate]

Folks, I want to know if there exists a command that just highlight some portions of the input text, rather than filtering it like grep does. To give an example, suppose the following input text: ...
1
vote
2answers
100 views

`open` command to open a file in an application

Why can't I run this command in my terminal: open index.html Wasn't it supposed open this file on my browser? Also can't I run this command: open index.html -a "Sublime Text". The result of these ...
0
votes
3answers
73 views

How to display size “human-readable” in lsof | grep /var* [duplicate]

I am currently trying to see , all the files which are using /var mount. With lsof | grep /var* when Its displaying size in bytes. How can I display file size in MB. Thank you.
0
votes
1answer
19 views

Find out user logged in at specific time on Mac OS X 10.11.x

I'll like to find out which user was logged in at a particular time that a file was created. I'm having trouble with the "Last" command when attempting to use the "-t" switch. Open to any ...
0
votes
0answers
12 views

Monitor shuts down when entering Terminal [Linux Mint]

I have a relatively small monitor for one of my machines that Linux Mint. When entering the terminal (ctrl + alt + F1) The monitor shuts down and I have to, completely blind, scrawl out my login and ...
1
vote
1answer
16 views

command to enhance console lines with history

cmd utils such as sqllite don't have full flavoured console support. but I do remember there is something called **wrap which could wrap this console and enhance its capabilities with history, up/down ...
3
votes
1answer
92 views

ss - linux socket statistics utility output format

When using ss with -p option, user/pid/fd column jumps underneath the particular line. For instance this is it what I'm actually seeing: # ss -nulp4 State Recv-Q Send-Q ...
1
vote
1answer
43 views

How do I change a LUKS password?

I would like to change a LUKS password. I want to remove my old password, but I would like to try out my new password before removing the original. I obviously know the old password. I would like to ...
1
vote
3answers
139 views

Number of occurrences in a text file where first character after 12th pipe is equal to 1?

I am fairly new to regular expressions and am looking for a sed/awk/grep/wc command to find the following in a pipe delimited text file the number of occurrences of the digit 1 after the 12th pipe. ...
1
vote
2answers
140 views

File manipulation; Insert a “;” every 12th, 44th and 60th character in every line of a text file

I have to make a csv-file from a textfile which contains data without any delimiters. Looks like: 2015021DUMMY001EAN1377689456777678945GERDE0002345 2015031DUMMY002EAN1345647876867867867TURTR0154565 ...
0
votes
1answer
23 views

control-w (delete word) deletes whole line in MariaDB client

I've been using the original MySQL client for "eons" and I'm rather accustomed to using bash-like shortcuts in it. One of my more frequently used ones is to use control-w to delete the word before the ...
5
votes
2answers
180 views

Command to remove the first N number of lines in input

Background I am running an SSH server and have this user that I want to delete. I cannot delete this user because he is currently running a few processes that I need to kill first. This is the ...
0
votes
0answers
22 views

How does GUI works different from the shell CLI?

For example if I want to remove a file I would write rm command in my shell CLI. But when I delete a file using GUI how does the process works ? For shell it would find the filesystem for rm program ...
1
vote
0answers
19 views

Search drive and copy source to flat target

I have backups and backups of backups (there are copies of copies) of images spread out over various drives. I want to scan the drives and copy all images from a source to one flat target directory. I ...
0
votes
3answers
32 views

Is there a way to know which files are being created, read or updated by running app? [duplicate]

I would like to list all files that have been read, created or updated from the app running.
2
votes
0answers
98 views

GLIBC not loading even after source compilation

While I am installing chef , I am getting below error. [root@centos Tools]# chef-server-ctl reconfigure /opt/opscode/embedded/bin/ruby: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ...
0
votes
1answer
24 views

Whatis command (shell builtin vs executable programs)

I know that whatis command is used to output a brief description about an executable program (Command). So both whatis cd whatis type Will print: nothing appropriate (Because from my ...
0
votes
1answer
29 views

pv (progress bar) and gzip

Why is this not possible? pv ${dest_file} | gzip -1 pv is a progress bar error gzip: compressed data not written to a terminal. Use -f to force compression. For help, type: gzip -h 0 B 0:00:00 ...
3
votes
2answers
331 views

The type command can't distinguish between an executable command and a shell script

So I was reading the book The Linux Command Line, and it says that commands are of four types: (1) executable programs (2) shell builtins (3) shell functions (shell scripts) (4) ...
0
votes
1answer
48 views

Can I make alias for alias in bash?

In some circumstances, I need to make an official alias for a set of command, which acts just the same as the original software. Like: alias ipython3="source /Users/zen1/miniconda2/bin/activate py3k; ...
-3
votes
2answers
48 views

C Programming on command line [closed]

What to do after opening vim name.c and writing the source code? I mean, to compile and execute.
5
votes
8answers
400 views

Generate two sequences of numbers separated by “|”

I'm using bash (CentOS 5) and looking to generate this output (I assume I could use seq or echo together maybe?): 1|1, 2|2, 3|3, .... 31|31, 32|32, 33|33, I googled seq examples for over two hours ...
0
votes
0answers
27 views

Usage of the <<< operator [duplicate]

I recently ran across an example usage of the bc to output an expression like this: $ bc <<< "1+1" Which is the equivalent of: $ echo "1+1" | bc Does the <<< operator just ...
3
votes
1answer
128 views

How can I write data separately in many text files which contain the same fields?

I have a text file which contains around 9999999 lines. Here I'm pasting the few lines: 1874641047 Gazipur 1874646347 Jessore 1845105653 Chittagong 1845146123 Narayanganj 1845164162 Gazipur ...