terminal

Copy nested folders contents to one folder recursively (terminal)

风流意气都作罢 提交于 2019-12-20 08:41:36
问题 I have a Wordpress upload folder that is structured using subfolders for months. wolfr2:uploads wolfr$ tree . . |-- 2007 | |-- 08 | | |-- beautifulkatamari.jpg | | |-- beautifulkatamari.thumbnail.jpg | | |-- beetle.jpg | | |-- beetle.thumbnail.jpg How do I use terminal to copy all the images recursively into another folder? I can't seem to wildcard folders like you can wildcard filenames. (e.g. *.jpg or *) (I'm on Mac OSX) cp -R ./*.jpg . ? 回答1: This will copy all *.jpg files from the current

How to turn off word wrap in iTerm2?

六眼飞鱼酱① 提交于 2019-12-20 08:36:56
问题 How to turn off word wrap in iTerm2? Is there a specific command to do so or in the preferences? I am trying to avoid having the text run down to the next line. I would rather scroll side to side. 回答1: lifted directly from https://apple.stackexchange.com/a/210666/115119 Props to @michid Disable line wrapping: tput rmam Enable line wrapping: tput smam 回答2: It appears that iTerm2 does not have the ability to turn off word wrap. There is an open issue (iTerm2 issue #1790) reported to "Provide

How to get the width of terminal window in Ruby

南笙酒味 提交于 2019-12-20 08:27:39
问题 Have you ever noticed that if you run rake -T in rails the list of rake descriptions are truncated by the width of the terminal window. So there should be a way to get it in Ruby and Use it. I'm printing some Ascii-art on the screen and I don't want it to be broken. therefore I need to find out the width of terminal at run time some how. Any Idea how to do that? 回答1: I've found that on Ubuntu, none of the other methods specified here ( ENV['COLUMNS'] , tput columns or hirb) give the correct

Rename files using regular expression in linux

北城以北 提交于 2019-12-20 08:27:21
问题 I have a set of files named like: Friends - 6x03 - Tow Ross' Denial.srt Friends - 6x20 - Tow Mac and C.H.E.E.S.E..srt Friends - 6x05 - Tow Joey's Porshe.srt and I want to rename them like the following S06E03.srt S06E20.srt S06E05.srt what should I do to make the job done in linux terminal? I have installed rename but U get errors using the following: rename -n 's/(\w+) - (\d{1})x(\d{2})*$/S0$2E$3\.srt/' *.srt 回答1: You forgot a dot in front of the asterisk: rename -n 's/(\w+) - (\d{1})x(\d{2}

ZSH iterm2 increase number of lines history

百般思念 提交于 2019-12-20 08:09:35
问题 Not sure if this is zsh, iterm2 or the interaction between them. Trying to change the number of recallable lines in the terminal - not the command history, the output history. In .zshrc I have : HISTFILE=~/.histfile HISTSIZE=100000 SAVEHIST=100000 This seems to be ignored =( Not sure of the correct term to google, "Terminal output history?" 回答1: It's not immediately obvious in the iTerm2 documentation on how to change it. open the iTerm2 preferences ⌘ + , select the Profiles tab then select

How can I turn off “scrolling the history” in iTerm2

大城市里の小女人 提交于 2019-12-20 08:01:26
问题 I have installed the new iTerm 2. It asked me in a yellow bar at the top if I'd like to enable a mouse feature. Unfortunately I don't remember the exact sentence anymore. By accident I approved. Now when I use the scroll wheel on the mouse in iTerm, it doesn't scroll the up anymore but instead it goes triggers the command history. Like if I would press the up-cursor. I couldn't find the right settings to turn that off again. Does anyone know where I can toggle this option? Thx for helping!

Is there a way to make a link clickable in the OSX Terminal?

巧了我就是萌 提交于 2019-12-20 08:01:07
问题 I am planning on developing an Mxmlc to Textmate formatter, one that formats mxmlc errors as clickable links, so you can open them up quickly in Textmate as Textmate has a url scheme e.g.: txmt://open/?url=file://~/.bash_profile&line=11&column=2. I am wondering if it is possible to display links in your OSX terminal, that are also clickable, e.g. by changing the PS1 variable or so. ps. I don't want to use HTML that runs in the Textmate environment. 回答1: Before OSX Lion: cmd + shift + double

SSH SCP Local file to Remote in Terminal Mac Os X

柔情痞子 提交于 2019-12-20 07:59:02
问题 I am attempting to copy a local file 'magento.tar.gz' from my local machine to a remote server using SSH through a VPN. This is connecting to the Virtual Machine's Internal IP which I've used as xx.x.x.xx here. I have full 'sudo' access on the SSH account so there shouldn't be any problem copying across. I have tried the following: I have tried the following (the magento.tar.gz file is already in the local root dir) sudo scp magento.tar.gz user@xx.x.x.xx/var/www/ This asks me to type in my

How do I update zsh to the latest version?

北城余情 提交于 2019-12-20 07:56:49
问题 I recently switched to zsh on my Terminal.app on my OS X machine successfully. The version number of zsh is 4.3.11. 回答1: If you have Homebrew installed, you can do this. # check the zsh info brew info zsh # install zsh brew install --without-etcdir zsh # add shell path sudo vim /etc/shells # add the following line into the very end of the file(/etc/shells) /usr/local/bin/zsh # change default shell chsh -s /usr/local/bin/zsh Hope it helps, thanks. 回答2: If you're using oh-my-zsh Type upgrade_oh

Why doesn't my squaring function run?

放肆的年华 提交于 2019-12-20 07:56:27
问题 I decided to make a program that would square a number just for fun. Using an online compiler, I entered my code and from what I saw there were no errors; it wouldn't run it would just have a blank console entry. My code: import math def square(): number = raw_input("Please enter a number for me to square.") number*number print "Your answer is..." print number Repl.it output: 回答1: Do make sure you also call your function: def square(): # your function body here square() But in your function,