To create a string with an incrementing number up to 1000 using bash.
Run the below.
seq -s "$(echo -e '\ntest\n')" 1000 > output.txt
To create a string with an incrementing number up to 1000 using bash.
Run the below.
seq -s "$(echo -e '\ntest\n')" 1000 > output.txt
If you need to view the post output from a kickstart file when debugging a problem. Add the below after the post step.
%post exec < /dev/console > /dev/console
To ouput ruby add the below to the top of your .rb file.
puts caller
After an update for Mac OSX sierra ssh would not allow access to dsa.
To fix this added the below to .ssh/config which fixed the problem.
Host *
HostkeyAlgorithms +ssh-dss
PubkeyAcceptedKeyTypes +ssh-dss
If when trying to install an RPM you receive the below error. Try running the below command on the RPM affected and then put this back into your repository.
Error:
Header V4 RSA/SHA1 signature: BAD, key ID 8816c449#012
Fix:
rpm --delsign your.rpm
If you want to get permissions for another user as root.
Run the below command
sudo -U USERHERE -l
To run a powershell command from cmd prompt just add the below. This is useful when using execute commands within chef as well.
@powershell Get-Help
execute 'powershell help' do command '@powershell Get-Help' action :run end
If your trying to automate running specific powershell commands, you can do this using the below example with -Confirm and WhatIf.
Set-ExecutionPolicy RemoteSigned -Confirm:$Y -WhatIf
To set windows timezone via command prompt.
Run the below.
tzutil /s UTC
For a list of available Timezone options run the list below.
tzutil /l
To run an aliased command remotely on servers. When trying to run the alias command add bash -ic to the command as show below.
bash -ic "mem"