Stack Exchange Network

Stack Exchange network consists of 175 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]

The tag has no usage guidance.

2
votes
1answer
48 views

Re-name script is overwriting part of the filename rather than prepending it

This SEEMS very simple to me, and i'm sure it will be to most of you as well, but I can't seem to understand why this is happening. Oh, by the way, i'm new here so please be gentle. :-) All i'm ...
0
votes
0answers
19 views

Move one file in a folder to another folder and rename?? Cmd?

I am hoping to get some help with this, I am thinking of using Command Line to do the following: Move ONE file in a folder (that has hundreds of files) to a new folder (new folder is the folder this ...
2
votes
1answer
55 views

Windows Command - Delayed Expansion Syntax to Echo The VALUE of a Variable That Contains Another Number Variable

I am trying to echo the VALUE of a variable whose name contains another variable ($project!$project_number!_control) while using delayed expansion. I can't figure out the syntax to do this. Here's ...
0
votes
1answer
160 views

How to print the last line of a gz compressed file in the command line?

I have a lot of gz compressed log files which have generic names and I need to check the period of time they reflect. I know about the zcat | head but this works for the beginning of the file only. ...
2
votes
0answers
36 views

Disable FTP commands on a per-user basis

I'm in the process of configuring an FTP server, using vsftp. I wish to have a couple different users. Some of these should only be able to read files, others should only be able to put files and some ...
3
votes
1answer
2k views

Return only a HTTP status code from curl command

I want to just get a statusCode from CURL command response. When I use this command: curl -I http://uploadserver.ln/1.mp4 I want to just get 200 rather than this long result: HTTP/1.1 200 OK ...
0
votes
1answer
112 views

IFTTT segmentation fault [closed]

I'm doing an assignment for school using getop with ocelot, I have to count words and count the substrings in the document. I have the word counting working but I was not able to do the substring, I ...
2
votes
1answer
142 views

fdisk with a a single command fail in the second execution

I ran a script to format a disk with fdisk like this: (echo n; echo p; echo $number_part; echo $firs_sector; echo $second_sector; echo t; echo $format; echo p; echo w) | fdisk /dev/$disk when i ...
0
votes
0answers
319 views

Mail command in AWS EC2 ubuntu instance is sending emails to spam folder

Recently, i have upgraded my EC2 ubuntu instance from t2.micro to t2.medium in AWS to fight space related issues. Though the upgrade went well, mail command which was working fine in t2.micro started ...
1
vote
1answer
82 views

how to stop for loop on another tty

We are connecting to the same host via the same user. So, only our sessions/tty are different. If one of us starts a for loop such as:for i in *; do command $i; done, I don't know how to stop it. All ...
2
votes
1answer
156 views

get output of command execution in Rudder? [closed]

I'm trying to use a User Technique in Rudder to monitor if my nodes has pending package updates. I create a Technique that execute: /usr/bin/apt-get update && /usr/bin/apt-get list --...
0
votes
1answer
36 views

Linux Script command interpreting not working remotely

I have the below linux script(simplified): RUN_JAVA=$(which java) if [ -z $RUN_JAVA ] then echo "No Java found!" >> /tmp/output.txt else echo $RUN_JAVA >> /tmp/output.txt fi When I run ...
0
votes
0answers
21 views

Can't use assigned variables after command

I have the following script filename="network_list.txt" while read -r line do name="$line" ping_stat=$(ping -c 4 $name 2>&1) if [ $? -ne 0 ] then echo "...
2
votes
1answer
50 views

Disabling a CMD command for a User

Let's say there are two accounts on Windows, Admin and User. Im running a program which shutdowns system in some ammount of time (using shutdown /s /t). Is there any way to disable shutdown -a for a ...
0
votes
1answer
40 views

When I use uniq -u I get no outpput, but why?

When I run the following command, I expect to get the ip addresses of ASG member instances: current_servers=$(aws ec2 describe-instances --instance-ids $(aws autoscaling describe-auto-scaling-groups -...
0
votes
3answers
2k views

One liner to check if specific port(s) is/are open

Redis Quick Start states: Make sure the port Redis uses to listen for connections (by default 6379 and additionally 16379 if you run Redis in cluster mode, plus 26379 for Sentinel) is firewalled, ...
-3
votes
1answer
150 views

how to identify the last logged in user in Windows 7 / Windows 10

I am a user in a domain where there are lot of cloud machines available.Now the problem is these machines can be logged in by any people .Though I can restart these machines using the command shutdown ...
0
votes
2answers
749 views

WSManCredSSP setting cannot be enabled

Im trying to set up 2 Hyperv 2016 Server hosts on my local network for remote access, but I just cant get them going. Servers are configured properly - both running: PSRemoting (also tried -...
-1
votes
2answers
480 views

Remove “Cc: ” from mailx command

I have recently setup a mail server on my Ubuntu Desktop 16.10, and I made a script that when a specific user logs in, they will execute the script instead of bash. Here is the script: #!/bin/bash ...
0
votes
1answer
172 views

find command with type and max date age

Is there a find command flag where I can set a max date age for files. Example would be only files within the last 2 days Also, a command I was given was -type f what does -type f mean?
1
vote
1answer
688 views

Continuously tailing a rotating log file with date and time in filename

I have a log file in format log_name_YY-MM-DD_HH_mm.log. The log rotates every couple of hours and the new log is created containing the date and time of it's creation. Sometimes I need to tail the ...
1
vote
2answers
4k views

How to cp files from sources to destination without using alias or non-alias and without getting confirmation/prompts?

$ cp /source/* /destination/ cp: overwrite `/destination/file1.conf` Aim is to copy files from source to destination without getting prompt or using non-alias(/) method.
0
votes
0answers
111 views

Remove com port using devcon for loop

I started learning command line yesterday. My supervisor asked me to delete extra com ports. I was trying to delete com port using command line. Right now I am using devcon.exe that is a part of ...
-4
votes
2answers
111 views

Error executing help manual pages on Fedora 25 for all kind of man pages

[user1@testMachine ~]$ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:...
0
votes
3answers
128 views

Enable confirmation for commands with force flag

Is there any option to enable confirmation for the rm -rf . We had an alias setup for rm=rm -i so whenever we delete a file it asks for confirmation but when -f flag is supplied it will not asks for ...
1
vote
0answers
140 views

Windows Server 2012 Scheduled Task window title is taskeng.exe (but not always)

We have several scheduled tasks running console apps on a Windows Server 2012 machine. When many of these run, and the console command window appears, the window title is "taskeng.exe" but sometimes ...
1
vote
1answer
113 views

Setting IP that i have pinged to be a variable

I am having great difficulty with a batch file i am working with. With the update i received below, i use nslookup to return the IP of the address. Is it possible to extract the IP returned with the ...
-2
votes
2answers
40 views

windows executable and extract data from file

On my CD-ROM I have this file: ip.txt which has the content: ip="192.168.1.1" netmask="255.255.255.0" gateway="123.456.789.2" How can I extract from ip.txt the IP, netmask and gw and use as command ...
2
votes
1answer
2k views

Trouble using powershell output as a variable in batch file

I can manually run this command from a Windows Command Prompt: powershell (new-timespan -start 01/01/2000 -end (get-date)).days % 14 And it returns a number from 0 to 13. I want to use this result ...
0
votes
1answer
84 views

One vagrant command to create and provision machine whether machine is created or not?

When my VM is not created, I can run: vagrant up or: vagrant up --provision but not vagrant provision, because of the warning: VM not created. Moving on... When my VM is created, I can run: ...
0
votes
1answer
197 views

Write to file (Nagios3)

I try to make script/command in nagios3 at write in new file some data but nagios will not do that. I try that simple bash command: printf "something" > /path-to-file/new-file But nagios don't ...
-1
votes
1answer
298 views

robocopy cannot find path [closed]

i have batch script like bellow: SET SOURCE=F:\Diff\For_VOYAGE\models.pck.files\models\players SET DESTINATION=F:\Diff\For_VOYAGE\models.pck.files\NEW\models\players SET LOG=LOG.txt robocopy %SOURCE%\...
0
votes
0answers
26 views

Run a script if another process was spotted

I have CentOS 7 and looking for a sollution about a small issue. I want to have a sudo script to be run but only if the system executed a specific command remotely. For example: I've put my command ...
0
votes
0answers
236 views

Delete files older than x days permissions

I have a folder that I have to run the following script find folder/ -ctime +7 -exec rm {} \; To delete files in the folder older then x days. But I can't let the root user do that, there will be a ...
-1
votes
2answers
79 views

Debian statistics - cpu, memory, hdd

I'm wondering how can I get my dedicated server avarage statistics for last month/ week. I used sysstat and sar to report my logs, but they are seems to be too much I'm interested about averege final ...
0
votes
1answer
1k views

SUDO command only works as root (Solaris 10)

After installing sudo in the system i am unable tu run sudo as a non-root user, when i try to execute any command i get: /usr/local/bin/sudo: cannot execute if i edit /etc/passwd to use a different ...
3
votes
1answer
2k views

How to find the ip address of the pc that sent a shutdown command?

I'm a system administrator in a school. We have a classroom with 20 PC's in a domain, and all PC's use the same user to log in. Sometimes students use the shutdown command to shut down the PC's of ...
13
votes
4answers
17k views

SSH authorized_keys command option: multiple commands?

The authorized_keys has a command="..." option that restricts a key to a single command. Is there a way to restrict a key to multiple commands? E.g. by having a regex there, or by editing some other ...
0
votes
1answer
216 views

What does '— --daemon' mean in start-stop-daemon?

On this man page for start-stop-daemon, there is an example: start-stop-daemon --start --oknodo --user food --name food --pidfile \ /var/run/food.pid --startas /usr/sbin/food --chuid food -- --...
5
votes
1answer
34k views

where is systemctl command in redhat 6.6 64 bit OS?

I was trying to run status of network by following commands. sudo systemctl status network However the system says systemctl command not found.
4
votes
1answer
3k views

Windows PowerShell - How to view commands history date/time [closed]

I want to list entered commands in Windows PowerShell with their respective timestamps. How can I do it with Get-History command? Also if that isn't doable then please show me a way to check which ...
0
votes
2answers
678 views

How to take backup of a table on a different schema in PostgreSQL

Please let us know in PostgreSQL how we can take backup of a table on a different schema. We have db named "geopostgrest" and under Schema named "1" (Not inside Public Schema) we need to take backup ...
1
vote
1answer
190 views

Command substitution into bash script $1 value

I have this simple script which changes permissions on my apache2 websites /var/www/html# cat permissions_setup.sh chown -R root $1 chgrp -R www-data $1 chmod -R 750 $1 chmod g+s $1 I have two .sh ...
0
votes
1answer
23 views

run remote command to save debian package list

I'd like to backup the package list(dpkg) of some remote computers to a backup server: all of them running Debian. I already configured the rsa key to login remotely as root on the other computers ...
0
votes
2answers
319 views

how to identify a command prompt window?

Enviroment: windows 7 Currently i have machine on which we launch 2 batch files on system start up. These batch files internally run multiple programs by running on separate command prompt windows. ...
-1
votes
2answers
71 views

Search for file names containing space

I have a batch file that helps me in install multiple pieces of software from a shared folder. It's working well with software whose names don't contain spaces, but I need it to work with software ...
2
votes
2answers
4k views

How to cp only into the latest directory name?

mkdir test_dir test_dir1 test_dir2 test_dir3 touch file1 file2 file3 cp -v file* test_dir*/ This copies only to test_dir3 and not in test_dir, test_dir1, test_dir2. Why? For that matter it copies ...
2
votes
3answers
931 views

Output of a command to the first line of a file

I am trying to insert output of a command into the first line of a file. For example, I have a file named "list.txt" and want to insert a text containing all the file names in that folder. A way to ...
1
vote
3answers
1k views

How to find which folder is eating space fast? [duplicate]

I am running Linux server, we using this server as a samba share drive. From yesterday suddenly, one of the share drive size getting increasing (~ 100 MB every ten min). There are too many folders and ...
1
vote
1answer
3k views

Issue command on multiple systems at once using MCollective

Aim The aim is to execute a command on multiple systems at once using MCollective, e.g., touch /tmp/helloworld using MCollective-client creates touch /tmp/helloworld on all MCollective-servers: ...