Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [command]

One or a set of directives issued in the *nix environment to get information, change the state of something or to execute something. In other words: To gain an objective.

0
votes
1answer
10 views

What differences between `type cd` and `which cd` commands in linux?

What differences between two below commands in CentOS7? $ type cd cd is a shell builtin and $ which cd cd is a shell builtin cd is /usr/bin/cd cd is /bin/cd The cd is a shell builtin command, but ...
1
vote
0answers
9 views

Automated logout of present session to refresh group commands?

So, I'm looking at automating a setup of service instances with AWS. AWS allows you to run shell scripts on instance creation. However! I've run into one little snag. I want, on initial ssh into the ...
0
votes
2answers
30 views

Pass Parameter to a redirected script in Linux

I have two scripts, suppose they are s1.sh and s2.sh. In s1, the code is step = 0 . .(omitted) . if [ $step -eq 19 ]; then ./s2.sh In s2, the code is step=0 . . (many codes here, but ...
2
votes
1answer
46 views

Get Unix to Tell Me The “x similar ones”

Often if I am doing something in the terminal I will mistype something and enter something unintended. If I type int as a trivial example, it tells me Command 'int' not found, but there are 18 ...
0
votes
1answer
26 views

Multiply column values by itself using awk

I would like to multiply column values by itself using awk. How can I do that? example 1 5 1 2 6 0 3 7 3 4 8 5 output 1X5X1 =5 1 5 1 5 X X X 2X6X0 =0 ===> 2 ...
0
votes
1answer
19 views

How can I get a count of a Word called 'MSH' used multiple times in a file with a single UNIX command - AIX 6.1?

How can I get a count of a Word called MSH used multiple times in a file with a single UNIX command - AIX 6.1 ?
5
votes
4answers
683 views

How do I display file names that contain two characters and one of them is c?

I tried doing ls [a-z][a-z], but it doesn't seem to be working.
0
votes
1answer
42 views

how to rsync the directory structure and only one file within each folder between two servers?

I have gigantic data consisted of branching tree of folders, sub folders, sub-sub folders and sub-sub-sub folders. Inside the terminal sub folder, I have large number of images (~ 2000 image each file ...
0
votes
1answer
19 views

excluding sub dir in command

I need to provide a detailed list of files in a directory in descending order of the file size. only to include 10 files in my output. I can not include sub directories in my output. I am having the ...
1
vote
2answers
48 views

display permission for all files that start with -

I need to display the permissions details for all the files names in a directory that begin with just "_". I have tried various commands using ls and find and no joy.
1
vote
1answer
22 views

Link Command Question [duplicate]

I am looking for a simple command in GNU/Linux to count all files in a directory beginning with pa. I have already executed the command to show all the files beginning with pa which I used find /etc/...
0
votes
1answer
38 views

Finding and moving images without extensions between two directories [duplicate]

I have an old disorganized repository of files in a directory. I would like to move solely the images files to a new directory for archival purposes. The problem is that in this directory I have a ...
0
votes
2answers
39 views

conditional statement result directly in bash without using if

output the name of the file with more lines, and how many more it has (one space between the name and number). If there is a tie, the output should be "foobar 0". eg: foo has 1 more line: "foo 1"; bar ...
0
votes
2answers
32 views

Why different command scripts are used for the same command when run as a normal user and when run as a root user?

I see the script location for the command date for a normal user, it shows which date /bin/date But when I run the same command from root it shows the output /usr/bin/date. Why so ?
3
votes
3answers
346 views

Do all different Linux distributions have the same command lines? [closed]

Do all different Linux distributions have the same command lines? What I want to know is the same command line works for all kinds of Linux distributions (CentOS, Fedora, Ubuntu, etc.) or whether they ...
0
votes
1answer
33 views

SSH Client Closed on Command Error

I am using Debian or Windows with Putty to connect to a remote Debian machine via SSH. The remote machine (Debian) behaves differently from the other SSH servers I know so far. Whenever I run a ...
0
votes
0answers
13 views

Where is size of password (for command passwd) set? [migrated]

There is header file pwd.h for programming language C. I want to know if this is the only file, where size of a password is set? Do I have to edit files of command mcrypt too and the files of shadow (...
1
vote
3answers
84 views

type ls command [duplicate]

so i studied somewhere about the type command and came to know that type command can provide the location of command used with it,more specifically the location of the executable file associated with ...
4
votes
3answers
88 views

In what format does piped output get sent and received from one command/program to another? [duplicate]

When a command is piped to another command in what way or in what format does the piped output exist/get sent? Is it a temporary file? Is it a string? And how does the command that receives the piped ...
-1
votes
1answer
109 views

Does a Linux command called (h) exist?

I read in an unofficial documentation about a Linux shell command called h: it was mentioned together with the help and man commands, without any explanation. So I tried it on my linux terminal but it ...
0
votes
1answer
19 views

How can I create a quick access command in the terminal for an application

I want to create a quick shorcut to a file wich is: file.py it is located in "/myfiles/folder1/file.py" I want to access just typing in the the terminal: "file" this file has a working directory so ...
0
votes
1answer
35 views

running command with the “default” environment

This question https://superuser.com/questions/319043/runing-a-command-without-inheriting-parents-environment suggests that we can run a command without inheriting parent's environment by $ sudo -u "`...
-2
votes
1answer
40 views

combining options in find command from a letter to another

Find all the files in /etc that have .config and starts with letter a to the files that starts with letter k, that's means all the files from a to k in /etc .config.
1
vote
1answer
46 views

Why does my script not take command arguments?

I have a script: #!/bin/sh function usage() { cat << EOF >&2 Usage: $0 [-h] [-rs <start_num>] [-re <end_num>] -h: help: displays list of options for command $0 -rs<...
1
vote
2answers
128 views

Source of information - command who

I would like to know how the command "who" pulls out information about ssh history into a Linux system. For example, on my shared-network workstation, where everyone can ssh into it: [johny@gandor ~]$...
2
votes
1answer
42 views

cron script cannot find logwatch and chkrootkit

I have an issue that has probably something to do with the PATH variable. This is a email I got with error about a script running in cron: Cron Daemon <mail.org> 05:08 (15 hours ago) ...
2
votes
2answers
86 views

Command not executing over SSH

I made this script for a course. It executes commands through ssh from the arguments of the script, on a number of remote servers specified in a file: #!/bin/bash # The server file. Can be changed ...
1
vote
1answer
31 views

divide file into equal counts [duplicate]

I have one .txt file which has more than 1 million record inside. (rownum from 1 to 1 million) I need to divide this file into two 500k files in linux. (file1 = rownum from 1 to 500k and file2 = ...
2
votes
1answer
56 views

OpenConnect: Passing-over user password when executing authentication request?

Currently I am using the following command for executing authentication request to obtain the server certificate (FINGERPRINT) and OpenConnect-Cookie: openconnect --authenticate --user=<username&...
0
votes
0answers
29 views

All file operation [duplicate]

How to find all the file operations done on particular Unix file (copy, move performed, how many times it's modified etc)? Is there any command which will provide detailed information?
2
votes
2answers
109 views

id -u $var gives the same output if $var has a value or not

I'm writing a script to configure new debian installs while finding the best solution to confirming that a user exists in the script, the best way I found gives me wierd output. PROBLEM: id -u $var ...
0
votes
2answers
149 views

check command line arguments

I would like to check if the first command line argument ($1) has an minimum amount of 10 characters and if it is empty. The script is called as: ./myscript.sh 2018-08-14 I tried this but it doesn'...
0
votes
0answers
20 views

Disable commands in Alpine Linux

I want to attempt to increase the security of some Alpine Linux Docker containers which run Nginx and other servers. I would like to disable commands like ls, cat, ed or sed, so that they are ...
0
votes
1answer
17 views

Using Script edit the file and replace some variable value

I have n number of servers like: c0001234.cloud.com c0005678.cloud.com c0009123.cloud.com I need to write one script that will login to these servers and edit one file. Basically there is one ...
1
vote
1answer
78 views

deepin-terminal: Failed to execute child process [closed]

I have written a simple script as below to run deepin-terminal and pass it a simple command but when I execute this script I get error. Script: #!/bin/bash deepin-terminal -m fullscreen -e "cmatrix ...
0
votes
0answers
17 views

How to use windows 10 files from centos7 without rebooting to windows 10

In my computer I install 2 OS Window10 and CentOS 7,In that i want to handle windows10 file from centOS 7 without rebooting to windows10 and use that file.So how It can work.
1
vote
2answers
89 views

how to gunzip multiple files at once to a specific folder?

I have a folder /mydata that contains several gz files. I would like to unzip all of them (while keeping the original zips) to another folder /myoutput How can I do that? Can I keep track of the ...
1
vote
1answer
158 views

How do I use “memusage” commmand for check Memory usage of Particular program

I Want to check Memory usage of the Particular program. I'm trying to use the memusage command, as documented in its manpage which is also present in Ubuntu. But running it produces root@username:~# ...
0
votes
3answers
120 views

How to extract an output from JSON to a shellscript variable?

What i did? [root@mdfdevha1 ~]# Group_ID=`/opt/keycloak/bin/kcadm.sh get groups -r TEST` [root@mdfdevha1 ~]# echo $Group_ID [ { "id" : "57c86153-11ba-4d19-aafb-9903ee00086b", "name" : "...
-1
votes
3answers
100 views

Execute command without terminal output [duplicate]

Let me give a bit of background to my question. I am using a terminal RSS reader newsboat which allows for the usage of macros to operate on links. For example, I have a macro running cd ~/videos &...
7
votes
1answer
130 views

Why was `.` chosen to represent the dot command?

I am wondering after seeing this question why the . symbol was chosen to represent the dot command? I am not able to find much about it's origin or who created it and am curious as to why a full stop ...
0
votes
1answer
52 views

nvim command not found, but works fine

So I'm trying to have nvim as my default editor in ranger and I'm about at wits end. To do this according to their wiki, I just need to export EDITOR=nvim. But it just comes up with a nvim command ...
4
votes
2answers
221 views

Write string to a file without a shell [closed]

Suppose I have an environment where there isn't a shell running, so I can't use redirection, pipes, here-documents or other shell-isms, but I can launch a command (through execvp or some similar way). ...
0
votes
2answers
219 views

Expect script connects with ssh but does not run commands

I need to write a script that runs on a PC with Centos 7 and connects to another PC with Centos 7 using ssh, execute a console command, for example "ls -la" and save the output of it to a file to be ...
0
votes
1answer
34 views

Create custom parameters (options) for already existing commands?

Recently I 've been wanting to create a custom parameter for pacman. To elaborate, I have tweaked pacman.conf so that specific packages (linux, linux-firmware, and a couple more) are ignored when I ...
2
votes
1answer
42 views

How can I sort blocks of data of varying length on a field in each block

I have an RDF file with blocks of data of varying number of lines delineated by < and />. Within each block, there is a field identified by name="some name". I need to sort the blocks on the ...
5
votes
3answers
616 views

Bash shadow a command - function with same name as command [duplicate]

I have a function in my .bashrc to automatically sudo to open files that aren't writable by me: vim() { if [ -w "$1" ]; then \vim "$1" else sudo env HOME="$HOME" \vim -u ~/....
0
votes
2answers
66 views

Combine several command in one shell script

I only can get the desire output when I run the command one by one. How can I combine all the command in a shell script and get the desired output? //insert timestamp column $ vmstat -n 5 | (while ...
1
vote
1answer
96 views

How to insert inline comment in multiline command?

I'd like to do this on bash apt install -y \ curl \ # i'd like to insert comment here somehow python3 But this doesn't work.
0
votes
3answers
60 views

Spliting a big file in to multiple?

I have a big file run_simulation.csh of about 1000 line #!/bin/csh ...