Tag Info

New answers tagged

0

Using bash brace expansion : cat SomeFile{1..100}.dcd >final_file You can have a check at first to see which files it is being expanded to by : echo SomeFile{1..100}.dcd Here {1..100} will be expanded to 1,2,3....100. Example : $ echo SomeFile{1..5}.dcd SomeFile1.dcd SomeFile2.dcd SomeFile3.dcd SomeFile4.dcd SomeFile5.dcd


0

Found the answer online here Open the terminal. Type ifconfig wlan0 and press [Enter]. You will not see any output in the terminal, as this command just turns your wireless card on. Most wireless cards are designated wlan0. If yours has a different designation, use that instead. Type iwconfig wlan0 essid name key password and press [Enter]. Replace name ...


0

You are missing the kernel-headers package which is a dependency for the nvidia Unified Driver module to be built. Install the kernel-headers package for your kernel version and reinstall the nvidia binary driver. dpkg-reconfigure should sort you out with the nvidia package after installing kernel headers.


0

Solution: With awk only print line numbers where there are differences and collect all in bash array. Instead use NR first awk subcommand use NR in last awk command: line_numbers=($(\ paste \ <(awk -F, '{print $1}' file1) \ <(awk -F, '{print $1}' file2) \ | awk '{if ($1 != $2) print NR}' \ )) echo "Length: ...


2

This is something awk handles very well by reading one file in memory and then replacing the items in the other one: $ awk -F, -v OFS="," 'FNR==NR {a[$1]=$2; next} {$1=a[$1]}1' f2 f1 new order,tested test,12345 new quote,test explore,34567 The idea is to store the values from file2 in an array values[file1]=file2. Then, when reading the file1 we replace ...


2

That's a job for join: join -t, -j1 -o 2.2,1.2,1.3 <(sort file1) <(sort file2) -t specifies the input and ouput separator -j1 is the join field (in both files the first one) -o ... the format of the output as desired in the question


2

Back-up important files (if you have any) after booting from a live-cd, then reinstall system. This is the only option that I know of.


0

So I'm trying to run a .bat file I have for a game. and its not working. I posted this image. maybe some one will know.


1

Your problem is the if…then. After the first call off boo you check the value of prompt and boo will be started, if prompt is y. After that, there is no more code to execute and the script exits. Using this script #!/bin/bash function boo { function goo { echo "Please enter name" read -r name; echo "Hello $name" } ...


5

From bash(1) history [n] With no options, display the command history list with line numbers. Lines listed with a * have been modified.


0

You can use the snappy command. The timezone is a property of the OS, which in Ubuntu Core is called ubuntu-core and this snappy part is managed by snappy itself. To read the current configuration for a part just run snappy config [snap part] And to apply one run snappy config [snap part] [config] To particularly change the timezone (to ...


2

The correct command is sudo su -c 'tar zcvf yourname.tar.gz /etc /var' or simply sudo tar zcvf yourname.tar.gz /etc /var And you forgot the space characters in your command: su -c 'tar zcvf yourname.tar.gz/etc/var/' ^ ^-- Missing SPACE -- Missing SPACE Your PDF has a very bad ...


1

It is possibe through GTK CSS config file. Create the ~/.config/gtk-3.0/gtk.css then you'll able to add some CSS selector and it's attributes. There are some good examples: Remove ugly fat bazel from gnome-terminal with multiple-tabs


0

These are further embellishments to be added to Lesmana's answer [1] slight embellishment: may i suggest adding the -i to make sure case of the query searched is no longer an issue: so to add to .bashrc >> alias locate-external='locate -d ~/.externalharddisk.db: -i' [2] As regards the updating of both databases; the one in the main HD and the new one ...


1

Nasal demons.1 man ps says (emphasis mine): comm COMMAND command name (only the executable name). Modifications to the command name will not be shown. A process marked is partly dead, waiting to be fully destroyed by its parent. The output in this column may ...


9

If unzip would have adhered to the pipes and filters architectural style characteristic of Unix, then one would expect to be able to do this by piping the output of wget into the input of unzip: wget -O - http://www.test.com/test.zip | (cd destination-folder && unzip -) Where the the dash after -O means standard output, the dash after unzip means ...


2

zsh might be able to get you halfway there: For me, zsh seems to prefer prefix completions (file<tab> will get me file filefrag file-roller, -file<tab> will get me apt-file desktop-file-install ecryptfs-rewrite-file grub-file ...). I don't understand the completion system well enough to make zsh do substring matching even if prefix matching ...


3

As far as I know, it is not possible to search sub strings of all possible commands at a time. You do though have the option of searching for sub strings of previously typed commands by using Ctrl+R and then typing your sub string. You can press Ctrl+R again to cycle through the previously typed commands containing this sub string


1

1. The command to type a phrase You can do that by using xdotool, which is not on your system by default. Install it first: sudo apt-get install xdotool Then the command to (literally) type a text phrase is: xdotool type 'This is a test to see if all works fine. If it works this text is typed.' The text will be typed in the frontmost window. Adding ...


8

You need more than one step: Go into your destination folder cd destination Download the file wget www.test.com/test.zip Extract the file unzip test.zip To use only one command use a script: #!/bin/bash wget -P "/tmp" "$1" filename=$(awk -F'/' {print $NF}) unzip "$filename" -d "$2" rm "/tmp/$filename" Open an editor to create a new file ...


1

Open tty1 via Ctrl+Alt+F1, login and install your driver. To kill the X server isn't necessary. Depending on your system it's pointless, because the server is restarted automatically. If the installation fails, start the recovery mode via grub menu (hold the left shift key during systems startup), start the network and the root shell and install the driver ...


0

So we have: a |-- .foo `-- bar and: b I took a huge time finding better solution than all the answers here. Then I took 30 seconds for this command: $ mv --help Then I found my love: $ mv a/ b/ -T Note: I don't even understand the argument -T. It just did what I needed. Here it says: -T, --no-target-directory treat DEST as a normal file


2

How about defining a custom bash function to do the job : move () { mv -- "$1" "$2"; cd -- "$_"; } put this move function at the end of your ~/.bashrc file. Run the function as move somefile somepath $1 is the first argument to the function (somefile) $2 is the second argument (somepath) $_ expands to the last argument of the previous command ($2 in ...


0

other than combining commands as you did the only other way would be to cd to the directory where you want to be in first then: ~/Documents$ mv ~/Desktop/somefile ~/Documents


1

Open your ~/.bashrc. Find this: if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi And replace \h with \H, like this: if [ "$color_prompt" = yes ]; then ...


3

Using a custom command for your mate-terminal profile, eg: sh -c "cd your_folder; exec bash" Replace your_folder with your preferred folder and bash with your shell if you need another one than bash The terminal in action If you made a mistake use dconf-editor to correct your problem: sudo apt-get install dconf-editor Start dconf-editor ...


1

Great question! If your allinfo command was the same as just apt-cache, (ie, without the show) then we could look at the completion for apt-cache, and apply that to your allinfo alias. However, you want a subset of the apt-cache completion, so we have a little more work to do. If we look in the completion definition for apt-cache - in ...


0

Home isn't a real directory: it's just what the file manager (nautilus) uses as a shorthand for the user's home directory, otherwise known in the shell as $HOME. It usually expands to /home/username (where username is replaced by your actual login name) but you should confirm by running echo $HOME in a terminal.


4

muru's answer is right that the package is called command-not-found. It basically provides a python script /usr/lib/command-not-found that actually does the main job. But the messages that you get in Ubuntu is actually defined by a function that actually exploits command-not-found's properties. Its called command_not_found_handle and resides in ...


6

The package, appropriately, is called command-not-found. The integration with bash for this package is part of the bash package itself, and unless you modified /etc/bash.bashrc, should work if you have this package installed. If you're using zsh, then add to /etc/zshrc: . /etc/zsh_command_not_found


3

Installing express globally generally isn't a good idea, the way most node modules work is by being installed on a per-repo basis so anyone can recreate the environment by running npm install. Thus the recommended way to install express is to run npm install express --save, which will not only download the module but also create an entry in the project's ...


1

Run xdotool commands to simulate key strokes instead Not literally what you asked for, but nevertheless a solution would be to use xdotool to simulate keystrokes / key combinations, and achieve the same result. If you add these commands to hot corners, you will achieve exactly what you describe. How to do that Install xdotool: sudo apt-get install ...


2

It seems that you're trying to delete the folder from within the folder itself and giving a non-existing path for rm to delete. Do something like: cd ~/tmp sudo rm -rf remaster-iso


3

It seems you have & somewhere in your url, hence the shell is sending the process to background. To solve this, quote the url. For example, if you use : curl https://www.example.com/myscript/foo&bar the shell will treat the url as https://www.example.com/myscript/foo and & after that will cause the curl https://www.example.com/myscript/foo ...


2

That is almost certainly not a dedicated program but just a part of Unity. I know this is the case for Cinnamon for example. As an alternative, you can set the hot corner to launch a terminal. That's basically the same thing except that you'll have to close the terminal manually. In the specific case of cinnamon, what is run is a java script. Cinnamon ...


0

I added this line to the bottom of my .bashrc and it works. export PATH=/home/[myusername]/android-sdk-linux/platform-tools:$PATH I don't understand the PATH=${PATH} syntax in your example, so I can't comment on whether it's correct or not, but you could try the syntax I used.


0

I have a managed to resolve the issue of the missing folders in nautilus by copying the .config file of a newly created user into my other home directory. I also had an issue of apps not unlocking from the launcher that was resolved my removing the zeitgeist folder and restarting the computer, thanks for everyone's help!


0

I have no idea for bash, but it works with zsh and some plugins Install the z-shell with sudo apt-get install zsh and set the z-shell as your standard shell sudo chsh $USER -s $(which zsh) and start a new terminal to use the z-shell Add Antigenv1 cd git clone https://github.com/zsh-users/antigen.git And configure # path to antigen clone source ...


0

It is a security feature introduced in the latest version of RVM, so you have to import the keys manually. Do what the error suggests: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 The gpg command contacts a public key server and requests a key associated with the given ID. In this case we are requesting the RVM ...


2

You can do this using read in a while loop instead of a for loop: #!/bin/bash while read line; do ((x++)) done < file echo $x exit 0 ~$ cat file word word ~$ bash script.sh 5


2

I think you will need to use while read line instead: x=0 while read line ; do x=$(($x+1)) done


4

You can't do this using the shell's field splitting. Adjacent whitespace characters from IFS are parsed together, so you cannot use field splitting to distinguish between adjacent whitespace IFS characters. From the standard (Shell and Utilities, section 2.6.5): Each occurrence in the input of an IFS character that is not IFS white space, along with any ...


0

All the answers suggesting wpa_supplicant are wrong. Yes, it may connect you to the WPA network, but that's a bad solution in the long run because it'll be very difficult to maintain and won't play nicely with a wired connection. Read this answer and make your life easier by using Network Manager from the command line. I wasted hours trying to configure ...


0

I believe what you are seeking to understand is a process called Quoting. Quoting works with double quotes and single quotes. If you place text inside double quotes, all special characters used by the shell lose their meaning, except $ (dollar sign), \ (backslash), and ` (back tick). Single quotes suppress all expansions. Escaping Characters are also ...


0

How about an example first, here we are looking for all files with .htm extension (case insensitive) recursively : $ tree . ├── spam │   ├── egg.htm │   └── egg.Htm ├── spam.htm └── spam.Htm $ find . -type f -iname *.htm ./spam.htm ./spam.Htm $ find . -type f -iname '*.htm' ./spam.htm ./spam/egg.htm ./spam/egg.Htm ./spam.Htm As you can see in the ...


0

Without quotes, the shell expands *.htm to a list of files and passes this list to find. With quotes, the shell provides the five character string *.htm as an argument to find. For example, with quotes: $ ls a.htm b.htm $ echo find . -iname '*.htm' find . -iname *.htm $ find . -iname '*.htm' ./b.htm ./a.htm The above works as desired. Without quotes, ...


2

It seems it has to do with changes made to gnome-terminal. However, scanning the changelogs and news I couldn't find anything specific. As you can see here in the file list of the 14.04 gnome-terminal package, the /usr/lib/ directory does not even exist. /usr/bin/gnome-terminal /usr/bin/gnome-terminal.wrapper /usr/share/applications/gnome-terminal.desktop ...


0

No special file has any useful purpose in either case. cat /dev/null is exactly a no-op, this command does absolutely nothing of interest and it can be replaced by any command that doesn't output anything. You can for example clear a file's content with any of these commands: printf > filename true > filename : > filename or even, with many ...


2

The short answer is No. These are two different techniques of Clearing a text file using cat /dev/null > file and cat > file followed by Ctrl + C. Redirection > is used to redirect output to some file. For example date will show the current time and date on std out $ date Sat Jul 25 20:56:09 IST 2015 If you use, $ date>/path/to/file Then ...


3

No, what is clearing the file is not /dev/null, but the > redirection, which intrinsically truncates the output file itself before redirecting the output of cat. cat /dev/null > filename: you're opening /dev/null and printing its "content" (nothing) to stdout; at the same time a file descriptor for filename is opened, the file is truncated and the ...



Top 50 recent answers are included