Tag Info

Hot answers tagged

27

In simple terms, a command is an instruction (or a set of instructions) to be carried out by a computer. Stand-alone commands Fundamental Unix utilities such as ls, ln, etc. are (usually) written in C and compiled to be stand-alone executable programs that don’t require an interpreter to be executed; they usually require certain library files to be ...


4

The above shell script suggested by statox is of course correct, but it does not take into account the fact the computer may go down in between the two checks, or you may logout, or you may interrupt the ssh session from which you are running the script. The simplest way to assure yourself against all these events simultaneously is to use the at command to ...


2

You could use something like that #!/bin/bash FILE=/home/Savio/Dsktop/check/sample.txt if [ -f $FILE ] then #Do what you want if file exists else sleep 5h if [ ! -f $FILE ] then #Do what you want if the file still doesn't exists fi fi The variable $FILE contains the path of the file you are looking for, it can be modified ...


2

In some inputrc file (/etc/inputrc, ~/.inputrc, ...) there is a line like: set show-all-if-ambiguous on Remove this line, insert # at beginning of line or change on to off. Alternatively put bind 'set show-all-if-ambiguous off' into your .bashrc Reference: http://tiswww.case.edu/php/chet/readline/rluserman.html#SEC9


2

Based on @Michał Górny's answer. Here are the commands to disable num-lock, use numbers anyway, and map numlock to F13 (may be handy to bind to a special function in your window manager). # NumLock is F13 xmodmap -e "remove mod2 = Num_Lock" \ -e "keycode 77 = F13" # Use numbers even when numlock is off xmodmap -e "keysym KP_End = KP_1" \ -e ...


2

When you first open the terminal, bash runs .bash_profile. You probably have modified .bashrc to add node to your PATH, but that is not executed until you run bash within the terminal. This difference leads to people advising to do this in .bash_profile: [[ -r ~/.bashrc ]] && . ~/.bashrc and on other systems, packagers do this for you as part of ...


2

A built in command is part of the shell. A program is executed by the shell. Builtin commands are contained within the shell itself. When the name of a builtin command is used as the first word of a simple command (see Simple Commands), the shell executes the command directly, without invoking another program. Builtin commands are necessary to ...


1

Command just means a way to tell an application or system to do something. An application will typically accept many different commands, either from the GUI, from stdin, but other methods are possible, e.g. a UNIX socket or named pipe, some sort of web API, an RPC connection, or some other custom protocol. An application that does only one thing, then ...


1

This bash function will block until the given file appears or a given timeout is reached. The exit status will be 0 if the file exists; if it doesn't, the exit status will reflect how many seconds the function has waited. wait_file() { local file="$1"; shift local wait_seconds="${1:-10}"; shift # 10 seconds as default timeout until test ...


1

Yes, you are. From "man iptables" [!] -i, --in-interface name Name of an interface via which a packet was received (only for packets entering the INPUT, FORWARD and PREROUTING chains). When the "!" argument is used before the interface name, the sense is inverted. If the interface name ends in a "+", then any interface which ...


1

This is not possible with LSB init scripts. They don't honor any dependencies itself. That INIT INFO comment section is there only for dependency-based boot where the dependency is resolved by external scripts and used for starting individual init.d scripts during boot. So in your current configuration the services A and B will be started in correct order ...


1

If you just want to replace <author type=''><\/author> with <author type='Local'><\/author>, you can use that sed command: sed "/<fiction type='a'>/,/<\/fiction>/ s/<author type=''><\/author>/<author type='Local'><\/author>/g;" file But, when you dealing with xml, I recommend an xml parser/editor ...


1

It's probably telling qsub to execute the command in the current working directory. pwd is the shell command "print working directory", which just reports what your current working directory is. Putting that command in `backticks` tells the shell to execute that command in a sub-shell and insert its output into the command line in that place. So if ...


1

To move all folders for years from 1980 to 1995, inclusive, run: shopt -s nullglob mv *'('{1980..1995}*/ /some/path/ The shopt -s nullglob command is not strictly necessary but it eliminates error messages if any of the years are missing. The above uses brace expansions, {1980..1995} to generate all the years explicitly. You can see how brace expansion ...


1

Try this quite an elegant command: watch -d dir_name


1

IMO, if you have already done reset than there is really nothing much else you can do. Bite the bullet and start a new terminal session instead. It basically happens to me when/after I wrongly cat the content of binary file to terminal. If it is beyond repair, then it is beyond repair.


1

I don't know how it works but running stty sane usually fixes those kind of terminal issues for me. Shell Prompt Given the description of your problem, I suspect that the issue may be related to your prompt. You have to be careful when setting prompts that include ANSI escape sequences that change colour, etc. Some of them cause bash to think the prompt ...


1

the "tick" character can be used to do that (the thing above the tilda), I believe. Try something like this: pdfunite [options] `ls | grep "handout...pdf"` From what I understand, that's how you nest a command. Anything inside the ticks is executed as its own command, and the output of it replaces the ticks. So, the command above would essentially ...


1

If your file patterns are that simple, you don't really need a regex, and you can use a simple wildcard: pdfunite handout??.pdf Otherwise, you can use a regex with the find command and -regex, but I could not find a way to execute it that doesn't have the possibility of splitting up into multiple groups of files. Some of the ways you might do it also ...


1

Best is 3rd I think. With the first and second, all but the last command will be executed. Then you'll have to hit enter again.


1

The first one isn't going to work in general if at all. Option two is ; but recognise that it says run command one after the other irrespective of whether the first ran successfully. So if first command failed the second one would run anyway. Option three is && which means in your example, run second command only if first command was successful. ...


1

The Cipher directive is for SSH version 1 (which is not in use nowadays). For SSH version 2, use Ciphers: sftp -oCiphers=aes256-ctr See ssh_config man page. Though note that sftp supports the -c switch too. So there's no need for using -o. See sftp man page: -c cipher Selects the cipher to use for encrypting the data transfers. This option ...


1

Here's what you need: find -name "(*)*" -type f | rename 's/\(|\)//g' It first finds files in the current directory matching the described name, then renames them by removing the brackets. You can see the matching characters ( and ) are replaced with nothing.



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