Skip to main content

All Questions

12 votes
2 answers
5k views

Check if current user can run sudo without requiring a password

I want to check if the current user running a BASH shell script has access to passwordless sudo or not. If they don't, I'd rather have the script exit rather than prompting them for a password.
Jay Taylor's user avatar
0 votes
2 answers
363 views

missing argument to `-exec' error when executing Shell script but runs fine on command lines

I have this Shell script here: ### # Create a folder dynamically mkdir archived_PA_"$(date -d "6 months ago - 1 day" +%Y-%m-%d)"_"$(date -d "1 day ago" +%Y-%m-%d)&...
Anna Nguyen's user avatar
0 votes
0 answers
25 views

Bash Script to output various data about a directory? (Directory owner, number of files, name/size of biggest file) [duplicate]

I am still very new to Linux, and I am tasked with writing a bash script that outputs various details inside a menu box. These details include: Directory owner/permissions, Number of files in ...
Luke's user avatar
  • 11
-2 votes
2 answers
56 views

Renaming object or element in perticular range in a column of text file

To expand on my previous question, I have another pattern of a file, I am trying to change the name of first column ranging from seq1 to seq20 (seq1-seq20) as seq1 similarly ranging from seq21 to ...
umar's user avatar
  • 117
0 votes
2 answers
44 views

How to add the strings in a particular line without hardcoding

I have 2 files, 1st file it has the output and another one template. I want to add ID's in the template from output without hardcode the value. Output.txt, abc 8392382222 def 9283923829 ...
Beginner's user avatar
  • 1,990
-1 votes
1 answer
945 views

What is the script to run multiple macro files in Teraterm?

I'm using Teratem to log the data of a server. For that, I need to run multiple macros, which have several Unix commands embedded in those macros. Currently, I need to go to, 'Control->Macro->...
Thamizh Mani's user avatar
-2 votes
1 answer
653 views

Redirect the output to two different files, One should have new output whenever the commands execute and the other should have both new & old content

Redirect the output to two different files, One should have new output whenever the commands execute and the other should have both new & old content. For example: openstack port create --network ...
Beginner's user avatar
  • 1,990
0 votes
1 answer
226 views

How to initiate rsync transfer from one server to another through ssh?

I'm trying to easily move some data with rsync from one server to another without actually connecting manually and doing all that, but only giving the IPs as arguments. # -- Variables my_key="...
techsk8's user avatar
  • 703
0 votes
3 answers
43 views

How to nullify multiple columns at specific positions?

Input- FN|LN|ADD|STATE|PIN|CONT|GRP|PCN|BIN|TOKEN72|TOKEN73|TOKEN74|TOKEN75|ndc|ncpdpd FN1|LN1|ADD1|STATE1|PIN1|CONT1|GRP1|PCN1|BIN1|TOKEN721|TOKEN731|TOKEN741|TOKEN751|ndc1|ncpdpd1 FN2|LN2|ADD2|...
shaik's user avatar
  • 1
0 votes
1 answer
356 views

awk prints if and else case

I wrote the following command: lsblk -nl /dev/sdd -o MOUNTPOINT | awk '{if (NR!=1 && $1) { print 1; } else { print 0; }}' It is supposed to check if any of the paritions of the given device, ...
Kyu96's user avatar
  • 183
0 votes
0 answers
1k views

How can I find the definitions for the -k, -e, and -p flags of ktutil addent?

I'm replacing a developer on a project & trying to understand their code: $ ktutil ktutil: addent -password -p $userName@$domainName -k 1 -e rc4-hmac Password for <$userName>@<$...
A yo's user avatar
  • 1
1 vote
2 answers
2k views

How to check Windows remote path exists from Linux command?

My Jenkins pipeline runs from Linux machine and I want to check if Windows shared path like - '\\domain\parent\child\grand-child\ exists or not through shell script. If same was to run from Windows ...
Alpha's user avatar
  • 157
1 vote
1 answer
3k views

How to get only memory peak usage with /usr/bin/time?

I am building a script with usr/bin/time program to monitor the RAM usage of a script and storing it in a variable so i can check if it is higher than a specified limit $mlimit, like this example ...
heresthebuzz's user avatar
0 votes
0 answers
557 views

How to store value of specific cell from console output table in a variable on Linux?

I have to get process id of process running against port 8080 hence executed command - lsof -i :8080 It returns output like - COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 2576 ...
Alpha's user avatar
  • 157
0 votes
1 answer
2k views

How to capture screenshot for certain commands on linux

I have Linux(Ubuntu, Centos) systems, I need to capture screenshot for each of the below command output and same need to be stored in $HOME/screenshot/path. Is it possible via (Mobaxterm) ssh terminal ...
user4948798's user avatar

15 30 50 per page
1
2 3 4 5 6