Tag Info

Hot answers tagged

5

You have to use a command substitution: #Generate random password PASSWORD=$(date +%s|sha256sum|base64|head -c 32) echo $PASSWORD then it should work. Prefer the "$" sign, read more here: Using backticks or dollar in shell scripts


4

You need to use a command substitution quotation, like PASSWORD=`date +%s|sha256sum|base64|head -c 32` echo $PASSWORD or you can do it as, PASSWORD=$(date +%s|sha256sum|base64|head -c 32) echo $PASSWORD


4

Use the built-in command history: history -w hist.txt will save the current history into file hist.txt. If you have write permsiions to the appropriate directory you could do something like: history -w /var/www/html/latest_history.txt Then your students could access it in a browser: http://teachers.ip.address/latest_history.txt


4

Simple really - you need to separate the commands. For instance this: #!/bin/bash sudo apt-get update sudo apt-get upgrade will update the package lists, and then the packages. Another possibility is this (probably better, as the && will only allow the upgrade command to run if the update exits successfully): #!/bin/bash sudo apt-get update ...


3

They are configuration files. One way: Open a terminal window using Ctrl+Alt+T Run the command gedit ~/.profile Add the line export PATH=$PATH:/media/De\ Soft/mongodb/bin to the bottom and save Log out and log in again


3

kill is an important part of Unix because it can kill a specific process even if another process has the same name. A Unix/Linux system will have kill but it may not have pkill or killall: in general, all Linux/Unix applications will always behave like kill exists on the system. Every admin should know how to use kill as it calls directly the system's inner ...


2

First type following command shopt -s to check weather histappend command is 'on' or 'off' If it is off then type following command to append history history -a If you want to save history with every new prompt run following command export PROMPT_COMMAND='history -a' For more information see this link


2

Generating a password just based on the current time is quite bad. As you want a 32-character password, I would do something like this: PASSWORD=$(head -c 16 /dev/random | md5sum | cut -f 1 -d\ )


1

Just to add a few points to the excellent answer by @Wilf, you can run commands in paralell if you want for any reason, for example, an autostart script for OpenBox might look like this: #!/bin/bash nitrogen --restore & tint2 & tilda This will set a background image using nitrogen, start the panel tint2 and start the Quake3-style dropdown ...


1

According to cron manual: When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists) If you want to stop mail alert, you should redirect standard output and standard error. So you should modify your cron file as: @hourly ...



Only top voted, non community-wiki answers of a minimum length are eligible