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

learn more… | top users | synonyms (1)

1
vote
3answers
36 views

How to combine two command outputs line by line? [duplicate]

let's say I have these two commands: $ cat file1 file1_a file1_b file1_c file1_d And: $ cat file2 file2_a file2_b file2_c file2_d How can I combine these outputs using a custom separator (e.g. .....
1
vote
1answer
18 views

bash kill process by call

I am using bash to start several instances of one python program, like this: python example.py -id $i where $i is the id given to the instance. All the processes are started on the same user, and ...
31
votes
2answers
111k views

Sending messages to another user

Is there any command to send messages through the Linux shell to other people on the same network? I'm using write user and then write the message itself. But there's any command that doesn't show my ...
15
votes
12answers
1k views

Bash script: split word on each letter

How can I split a word's letters, with each letter in a separate line? For example, given "StackOver" I would like to see S t a c k O v e r I'm new to bash so I have no clue where to start.
24
votes
4answers
15k views

how to download a file using just bash and nothing else (no curl, wget, perl, etc.)

I have a minimal headless *nix which does not have any command line utilities for downloading files (e.g. no curl, wget, etc). I only have bash. How can I download a file? Ideally, I would like a ...
0
votes
1answer
521 views

nmcli connection activation failed

I was able to create a wifi hotspot on my debian 8 install using network tab under gnome settings. I was trying to do the same using nmcli but it always shows $nmcli con up id Hotspot Error: ...
0
votes
1answer
33 views

Network slowness [closed]

I am facing an issue in my project.We support an App which is hosted on a unix server. Partners try to access the same from many regions. Now some users in an region say "R" are complaining about ...
18
votes
9answers
86k views

How to boot Linux to command-line mode instead of GUI?

I am using 32-bit Red Hat Linux in my VM. I want to boot it to command-line mode, not to GUI mode. I know that from there I can switch to GUI mode using startx command. How do I switch back to command-...
31
votes
10answers
66k views

Converting multiple image files from JPEG to PDF format

I want to convert some files from jpeg to pdf. I am using following command. $ convert image1.jpg image1.pdf But I have 100 images. How should I convert all of them to corresponding pdfs? I ...
4
votes
5answers
69 views

terminal command | grep IP

ifconfig -a | grep 10.16 inet 10.16.x.xx netmask 0xffffff00 broadcast 10.16.x.xxx inet 10.16.x.xx netmask 0xffffff80 broadcast 10.16.x.xxx I have replaced the numbers with x My aim is to ...
6
votes
0answers
931 views

How to use terminal to access iCloud Drive when Finder is not running

I would like to access iCloud drive from Terminal in order to create an emergency backup. Unfortunately, my installation of Mac OS Yosemite is not operational, so I am using recovery mode to create my ...
19
votes
1answer
3k views

gvim -p limit of opened tabs?

When I run : gvim -p *.xyz I find that not all files are opened in tabs. It feels, like a kind of tab limit? But ! When I try to open unopened with : :tabnew it is opened next to previous ...
2
votes
2answers
372 views

Less command change color of “~” and “(END)”?

How do I change the color of the "~" characters that go along the edge of a Less command output. And how to change the color "(END)" at the bottom?
2
votes
5answers
8k views

how to find out the ip of an ssh HostName

Is there a simple way to retrieve the IP of a HostName from an ssh config on the command line? Many times I have to use scp and would like to connect to a machine, but I remember only the HostName.
1
vote
1answer
32 views

cat into stdin then pipe into program keeps forked shell open, why?

I'm not sure what's going on but I've been trying to understand what is happening with the input and output. So here is my program. #include <stdio.h> #include <stdlib.h> int main(){ ...
0
votes
2answers
55 views

How to execute a shell script from anywhere on my server?

So basically I have a JS app that is inside a directory in /var/lib/app/. To start this node app I execute a start script startapp.sh from inside the directory. Now I need it to start at boot time, ...
21
votes
5answers
9k views

command to layout tab separated list nicely

Sometimes, I'm getting as an input tab separated list, which is not quite aligned, for instance var1 var2 var3 var_with_long_name_which_ruins_alignment var2 var3 Is there an easy way to render ...
0
votes
0answers
7 views

when installing KODI, I get this error

Errors were encountered while processing: /var/cache/apt/archives/kodi_2%3a17.0~git20160721.0200-e1f73d5-0xenial_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1) i think its because ...
0
votes
0answers
8 views

How to use the man command to view documentation [duplicate]

I don't find man command to be much useful because I can't figure out what the flags are for and how all of them come together.
0
votes
0answers
16 views

Change location of executable [duplicate]

I wanted to install x264 cli encoder on OS X. I copied the downloaded binary to /usr/bin/, changed permissions and voila - it worked. Then I decided to be a smartass. So I deleted the file and ...
30
votes
4answers
26k views

What is the meaning of IFS=$'\n' in bash scripting?

At the beginning of a bash shell script is the following line: IFS=$'\n' What is the meaning behind this collection of symbols?
1
vote
2answers
44 views

Execute multiple ssh commands with different switch

I have a bash script for copying two files from a remote machine (that I cannot control), stored in a a path that needs root access. Here it is: ssh administrator@host "mkdir ${DIR}" ssh -t ...
3
votes
1answer
2k views

How to access u boot environment from linux?

How can I access and change the u-Boot env variables in linux. Using the u-boot/tools/env directory in u boot directory: u-boot$ make env Which created the executable file fw_printenv. I copied ...
3
votes
2answers
43 views

Protect session log from being written again by anyone

We have implemented a workaround to save command history in a new file for each user session for audit purpose. So each session file is identified by the start time and the username. The problem: The ...
0
votes
1answer
43 views

Undo last command possible? [duplicate]

In windows you can undo an operation if you press CTRL+Z. E.g. you delete a file in the gui then press CTRL+Z and the file will be restored and appears in the folder again. Is there something similar ...
0
votes
1answer
61 views

mv not working in script, but works fine on the commandline

I am trying to put together a simple script that renames a few files and directories. If I type the entries directly on the commandline they work fine. But as soon as I put them in a script it doesnt ...
0
votes
1answer
45 views

sed works on commandline but not in script [closed]

Why does this work when I type it direct on the commandline: oldversion=12345 newversion=67890 sed -i "s/${oldversion}/${newversion}/g" "/home/user/MyDir_${newversion}/MyDir_${newversion}.reg" But ...
1
vote
1answer
50 views

Find files in a directory for two days i.e today's and Yesterday

I need a command or shell script to find files within a folder for today and yesterday in Linux. Example If I run the command today it should give me the list of files created today and also ...
10
votes
5answers
31k views

How to pass each line of a text file as an argument to a command?

I'm looking to write a script that takes a .txt filename as an argument, reads the file line by line, and passes each line to a command. For example, it runs command --option "LINE 1", then command --...
1
vote
0answers
45 views

Install torrent CLI on montaVista 6

I have been trying to figure this out for a while now but I have never made any progress with it. How can I install a torrent client on my NAS (Seagate Central) box which runs MontaVista 6. I have ...
1
vote
2answers
39 views

inaccessible directory

I git cloned into a directory "/source" before I mkdired it. It did not show up in its parent directory, but when I run the ls command, the output is indented like this: database static ...
1
vote
1answer
36 views

Something like $CDPATH that works for all bash commands

I'm trying to figure out if there's a way I can get $CDPATH working for every command-line tool. At the moment, I have a directory in my homedir that's called src/ which contains all of my projects. ...
2
votes
2answers
218 views

What is a Linux command that lists only USB storage devices?

I would like to list only the USB storage devices connected to my computer. Since these are SCSI disks, I used the command lsscsi, which lists the USB drives as well as my computer's hard drive and CD ...
-3
votes
0answers
33 views

Unable to move, rename, or execute executable file [closed]

I downloaded a software package to interact with a SDR. To make the file executable I ran: chmod +x qt-linux-opensource-5.0.2-.86-offline.run in the directory of that file. I then tried to run it ...
7
votes
2answers
64 views

Display stdout and stderr in two separate streams

I'm looking for a way to visually separate stdout and stderr, so that they don't interleave and so that they can be easily identified. Ideally, stdout and stderr would have separate areas on the ...
18
votes
6answers
12k views

Make cd automatically ls

I find that I often do the following: %> cd bla/bla %> ls I would like it that whenever I cd into a directory it automatically does an ls. I fiddled with my .bashrc for a while, but couldn't ...
0
votes
1answer
24 views

Copy folders has specific part of name and it is content

I have a long list of folder as follow: 001_bat_3513 002_mon_3213 003_bat_3515 004_btt_3540 005_bat_4513 055_bpt_8523 056_bot_3513 058_bat_1513 . . From this list: How can I copy the folders ( and ...
3
votes
5answers
346 views

When I redirect the output of ls to a file, the filename is included in that file. How can I avoid this?

Observe: $ ls $ ls > list $ cat list list This appears to indicate that when ls is executed that the redirection into file list has already begun and the list file is already created. A fine ...
0
votes
1answer
54 views

ctrl-c unsets echo on terminal [closed]

On different Linux distributions I experienced that pressing ctrl-c to stop a program (like 'cmp') or completion causes the terminal (usually xterm or gnome-terminal) to not echo the input any more. ...
17
votes
5answers
65k views

How can I pass a command line argument into a shell script?

I know that shell scripts just run commands as if they were executed in at the command prompt. I'd like to be able to run shell scripts as if they were functions... That is, taking an input value or ...
-1
votes
2answers
50 views

How can I see the number of visitors in my website via CLI

How can I find out the number of visitors in real time in my website? I'd like to access to it via SSH, so it should be some CLI programs. In the worst case scenario I was thinking to analyse the ...
1
vote
2answers
50 views

Replace particular character but not if it is inside ()

I'm looking for a one-line command to make a file more readable. I want to replace all ; characters with newline unless it is inside a set of (). This is on a firewall, so I can only use bash; no ...
3
votes
1answer
25 views

Override an existing folder with cp

Is it possible to override an existing folder with cp? Example: tux@linux:~ $ cd /tmp/test/ tux@linux:/tmp/test $ mkdir A tux@linux:/tmp/test $ cd A tux@linux:/tmp/test/A $ touch 1 2 3 4 tux@linux:/...
1
vote
1answer
35 views

remove lines that contain IP range from specific column while making exclusions to range

I have a logfile with the following format: Jul 13 21:47:41 192.168.100.254 "user from 192.168.100.101" I need to remove ALL lines that contain IP's in the 192.168.x.x range but only if they appear ...
1
vote
3answers
37 views

Create link between two existing files

For example: I have file a.txt and file b.txt. I want a link from a.txt to b.txt. If I open/read file a.txt, file b.txt should open/read. If I try something like ln -s a.txt b.txt I get an error ...
1
vote
1answer
37 views

copy a file to a destination with different names

I want to copy a text file to a directory with multiple names with curly braces: cp /path/to/file/a.txt /path/to/file/{b,c,d}.txt But it gives me the error: target '/path/to/directory/d.txt' is not ...
2
votes
2answers
43 views

Can't create a file through symbolic link

I have a directory that goes like this: drwxrwxrwx 6 www-data www-data 4096 Jun 8 10:21 ./ drwxr-xr-x 31 user1 user1 4096 Jun 8 10:40 ../ lrwxrwxrwx 1 www-data www-data ...
0
votes
2answers
46 views

Command “paste - - - - ”, how to specify a big column number

In command paste - - - -, numbers of - is equal the future column number. In my case, I have 55,000 future column, for me wont need to put 55,000 - what I will can use? Example: title1:A1 title2:A2 ...
1
vote
1answer
824 views

Is there a way to find the uptime of a network card in unix?

Some of the information i am requesting can be gleaned from /var/log/syslog , e.g: grep wlan /var/log/syslog But the usefulness of that information also depends on how you are network connecting; ...
15
votes
3answers
1k views

Manipulating X key and pointer grabs on the command line

What command line tools exist to list and manage X server grabs? (That's grab as in key and pointer grabs, i.e. restricting the use of a particular key or mouse button to a particular application, or ...