Tag Info

Hot answers tagged

18

command is a bash builtin as we can see: seth@host:~$ type command command is a shell builtin So we know command is provided by our shell, bash. Digging into man bash we can see what its use is: (from man bash): command [-pVv] command [arg ...] Run command with args suppressing the normal shell function lookup. ...


10

Your friend on another computer probably uses an OS which has /bin/sh linked to /bin/bash. In Ubuntu (actually, Debian and most Debian derivatives), /bin/sh is not linked to /bin/bash, but to /bin/dash, which doesn't support many bash-specific features, but is considerably faster. On Arch Linux: $ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Sep 28 15:26 /bin/sh ...


7

echo -e and echo $'...' are both similar in that they support the following escape sequences: \a alert (bell) \b backspace \e \E an escape character \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \\ backslash \0nnn the eight-bit character whose value is the octal value ...


7

The following oneliner should do the job: find . -maxdepth 1 -type f -name '*.jpg' -exec perl -e '$a="{}"; $a =~ /(\w+)/; `mkdir -p $1 && mv "$a" $1`' \; Explanation find . -maxdepth 1 -type f -name '*.jpg' will look for files (-type f) only in the current folder (. -maxdepth 1) with the jpg extension. -exec will call the perl command for every ...


3

It has two different uses: One use is to ignore aliases and functions, and run the executable file found in PATH, even when an alias or a function with the same name exists. As example, I'll use an alias for ls that appends a / to directory names: $ alias ls='ls --classify' $ ls -d . ./ $ command ls -d . . In an interactive shell, it may be more ...


2

A pipe (represented by the | symbol) sends the standard output of one process to the standard input of another. In your case, you appear to want to use a named file so a pipe is not appropriate - specifically, there is nothing to pipe (hence the gunzip error) because the remote contents are going to a local file. Instead, you'd need to extract the name of ...


2

I would use a for loop for this. for file in ./*" "*.jpg; do word=${file%% *} mkdir -p "$word" && mv "$file" "$word" done You can run this in an interactive shell, or put it in a script. Bash is very useful to know, so I recommend learning it by reading the Bash Guide when you have the time.


2

The script that you dropped into /usr/local is not a usable netbeans application but rather an install script for it. Move it back into your home directory somewhere and following the installation instructions found here: Netbeans IDE - Installation Instructions


2

Move if you only need it in the target path, copy if you need it in both locations. There's no inherent "insecurity" to mv or cp, and you'll be needlessly adding complexity (and extremely likely bugs) to your scripts if you start trying to implement your own mv. For special cases there may be more suitable tools than either. For example, if you want to ...


2

You need to use sort before uniq: find . -type f -exec md5sum '{}' ';' | sort | uniq -w 33 uniq only removes repeated lines. It does not re-order the lines looking for repeats. sort does that part. This is documented in man uniq: Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use sort ...


2

The input for uniq needs to be sorted. So for the example case, find . -type f -exec md5sum '{}' ';' | sort | uniq -w 33 would work. The -w (--check-chars=N) makes the lines unique only regarding the first column; This option works for this case. but the possibilities to specify the relevant parts of the line for uniq are limited. For example, there are ...


2

This is probably enough: cp /media/Downloads/Complete/Movies/[tT]he[\ .][A-Ma-m]* /media/Movies_A/ cp /media/Downloads/Complete/Movies/[tT]he[\ .][N-Zn-z]* /media/Movies_B/ cp /media/Downloads/Complete/Movies/[A-Ma-m]* /media/Movies_A/ cp /media/Downloads/Complete/Movies/[N-Zn-z]* /media/Movies_B/ I used cp so you can redo it as many times as you like. ...


1

I was able to duplicate the same problem by making changes to PS1 in bashrc. Since I don't know exactly what was edited in your case though, try restoring the previous bashrc file using the following. cp ~/.bashrc ~/.bashrc.bak cp /etc/skel/.bashrc ~/ source ~/.bashrc EDIT: Close and reopen terminal after running this. This fixed the cursor overwriting ...


1

Quick answer, try this: #!/bin/bash DRI_PRIME=1 xfce4-terminal --window -H -x glxgears -info Don't know if all the switches are needed, but it worked.


1

Consider this script (saved as /home/muru/test.sh): #! /bin/bash DRI_PRIME=1 glxgears -info A basic launcher for this would look like (say, save it as /home/muru/test.desktop): [Desktop Entry] Type=Application Terminal=true Name=glx-gears-info Exec=/home/muru/test.sh Make them both executable: chmod +x test.sh test.desktop Now you should have these ...


1

The xdotool commands to use are: Zoom in (aka Ctrl++) xdotool key Ctrl+plus Zoom out (aka Ctrl+-) xdotool key Ctrl+minus Normal size (aka Ctrl+0) xdotool key Ctrl+0


1

I put the script in the Startup Applications and it works now fine


1

Whenever you get messages about missing packages (or suggestions to modify your PKG_CONFIG_PATH) during a build, it usually indicates that you are missing the corresponding development package - which is typically separate from the runtime package that is normally installed on the system. In this case you have the most recent version of fontconfig but are ...


1

/usr/local/ itself isn't in the default path, /usr/local/bin is. Move your launch script there and it should be picked up.


1

To find which commands bash runs on start-up and which file those commands came from, run: PS4='+$BASH_SOURCE> ' BASH_XTRACEFD=7 bash -xl 7>&2 The output is lengthy but the source of the gibberish will hopefully be clear. Explanation: PS4='+$BASH_SOURCE> ' When creating an execution trace, bash will prepend every line with an expansion of ...


1

A quick way would be check if the SSH_TTY variable is set: $ ssh lab $ echo $SSH_TTY /dev/pts/22 There are a few SSH-related variables set. Two others are SSH_CLIENT and SSH_CONNECTION. Either of them could be used as well. Another way would be to check if an ancestor process is the sshd daemon: $ pstree -ps $$ ...


1

It lets you run a shell command ignoring any shell functions. http://ss64.com/bash/command.html


1

When the shell encounters text enclosed in $( ), it: Takes it to be a command and (as bodhi.zazen says) runs the command in a subshell. Substitutes the output of the command, in place of the entire expression (including the opening $( and closing )). As heartsmagic's answer explains, this is one of two available syntaxes for command substitution. "What ...


1

It's possible this is a compiz/nvidia bug. I noticed very similar "screen flashing" that seemed tied to screen redraws, e.g. chunks of the screen would redraw strangely as the cursor blinked, or if I turned off the blinking cursor, would just fail to redraw at the right time. https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1314367/ describes the ...


1

It depends. In certain (usually rare) situations you should cp the file to a temporary name on the target filesystem, then mv it to it's final name, as the mv operation is autonomous on a journaled file system. If there is any chance the application will try to read this file while you are replacing it, do this. You specified that you are transferring the ...



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