Tag Info

New answers tagged

2

I am not aware of any size limits for here-doc. I'm running kernel 3.9.1 and I've been experiencing the same issue here: when pasting large chunks of text in terminal some lines are truncated or missing. I found out (after some googling) that if you turn off line editing, pasting works fine (discussion here: Pasting large amounts of text into ...


1

I guess almost all Distros have a minimal version without GUI. Dont know any below 80MB, but I suggest the CentOS minimal, which is around 400MB. But there are distros below 80MB but they include both GUI and CLI. So I guess if 80MB is your limit you can use them and simply not use the GUI. Slitaz is just cool. Damn Small Linux (DSL) lol :D just 10MB.


0

You can Install "Ubuntu command-line system" and try Minimal CD. The command-line version of Ubuntu is a sparse system without any graphical elements. It's a text-only version of what lies underneath all the advanced graphical elements. It's also the starting point for a minimal installation. You can download following Ubuntu 32 or 64 bit minimal ISO ...


2

cpufreq-info - Utility to retrieve cpufreq kernel information. It will list available frequency steps, available governors, current policy etc. cpufreq-set - A tool which allows to modify cpufreq settings (try e.g. cpufreq-set -g performance or cpufreq-set -f 2 GHz once you know what frequencies your CPU can be set to) You can also retrieve information ...


0

You may also try using locate utility, e.g.: updatedb -o ~/tmp.db -l0 -U $PWD; cd $(locate -d ~/tmp.db -l 1 -b -r foo-) For more complex regex pattern check info locate.


0

Based on the final requirement you don't need cd; you can do the following: find . -type d -name 'foo-*' -exec make -C {} ';' and find . -type d -name 'foo-*' -exec phing -f {}/build.xml ';' The asterisks are handled by find internally, and I believe this is POSIX compatible.


0

Does drush mung backticks and vertical bars?  If not, you could use cd `ls | grep foo- | head -n 1` If backticks don't work, but |, $, ( and ) do, then you could change the above to cd $(ls | grep foo- | head -n 1) If | doen't work, but $, ( and ) do, then you could do cd $(myprog) where myprog is a script that you write to determine the directory ...


3

... | tee /dev/tty | ... /dev/tty is the "file" that refers to your terminal.


0

There are many CUE Splitters available online, however, most of them are only compatible with Windows. Usually, Mac users can't find a way to split CUE associated MP3, APE, WAV, FLAC, etc. What's more, most of CUE Splitters support splitting only one or two kinds rather than almost all common audio files with CUE sheet. You may prefer this step by step ...


3

Command line ranges can be use to select a specific line that needs to be edited. Then substitute pattern can be used to perform the edit (append). For example, to append text "hi" at the begining of line 3: vim -c "3 s/^/hi/" -c "wq" file.txt To append text "hi" at the end of line 3: vim -c "3 s/$/hi/" -c "wq" file.txt To find more options and ...


3

Generally applications that take too long to execute and dosent require user interaction are sent to background so that we can continue our work in terminal. Jobs running in background are treated same as jobs running in foreground except that their STDOUT, STDIN and STDERR varry. If you have a job that take too long, like file compression or backup you ...


0

If you execute an application that needs - let's say 5 minutes to end, for example a copy job - the shell is blocked while the program is running, the whole 5 minutes. The copy job is then in the so called foreground process group, indicated by a + sign in ps. You may need to do some other work during that 5 minutes, but the shell is blocked. On the other ...


0

Couple of commands that could help you on understanding it are, From any directory (assume /home/somedir), run the below commands. stat ./ - It will give out an inode number. find /home -inum inode_number - It will list the directory from where you originally executed the stat command.


-1

Short answer: just use less and forget about more Longer version: more is old utility you can't browse step wise with more, you can use space to browse page wise, or enter line by line, that is about it. less, is more + more additional feature you can browse page wise, line wise both up and down, search


0

Shells have two uses: to run scripts, and for an interactive command line. Dash is designed to be a fast, efficient shell for scripting. It has next to no nice features for interactive use. It doesn't have fancy prompts, command line edition, command history. It doesn't run a configuration file like bash's .bashrc when you start it interactively¹. You can ...


1

The command to set the system time is date. You need to be root to set the system time. date sets the time to the given time, not to a relative amount from the current time, because that latter behavior would be pretty pointless. You can build a command that modifies the current time by a relative amount by making a calculation on the output of date and ...


4

The easiest way to do that kind of thing is to use the shell's globbing and/or brace expansion features: cat linux.{0..3}.txt or cat linux.*.txt As others have explained, cat does not load the whole file into memory, it will just read a few bytes from it, print them to screen and repeat until everything has been read.


1

You can easily try things out for yourself and see if they are working without changing your current login shell. Apart from /etc/profile and ~/.profile, dash will read the file pointed to by an environment variable ENV when starting interactively so: ENV=~/.bashrc dash or better make a copy of your ~/.bashrc to ~/.dashrc and comment out/delete what you ...


3

Lots of the commands in your .bashrc are bash-specific. Things like HISTCONTROL aren't relevant to dash. Likewise for the command completion. Aliases will work however. Read the manpage for dash and check the manpage for each thing you're doing in your .bashrc to see whether it's applicable to dash. The real question you're asking is not very clear: do you ...


1

This one seems to fit the bill, it's free and open source and even works on Windows :) It even has advanced stuff, like instead of blindly picking any frame at the particular interval, it can pick ones that are close enough but don't look too blurry, so instead of doing this: You can pass it a parameter (-D6) so it does this: Plus I really like no ...


1

I just discovered this little program called puddletag. It is not as wonderful as Tag & Rename, but it's close enough.


1

To link with a library with a filename libad.a you link options to gcc should be: gcc abc.c -lad So you don't specify the extension, nor the starting lib part of the library file name. The output file will be a.out. You can specify extra search paths for the library with -L: gcc abc.c -L path_to_directory -lad


0

That was because the downloading was not complete, Although Chrome showed that it is complete I re-downloaded from another browser and it work fine now.


2

After seeing your CSV output, the problem is clear: you told Excel to use CR line endings, probably because it informed you that they are "Macintosh" style. That is badly outdated information, not true for over a decade now. There are three main line ending styles: LF: The style used by Unix and all its primary derivatives, including Mac OS X. CR: The ...


0

An “action in Linux's terminal” is presumably a command that you typed at a shell prompt. Typical shells record a history of past commands. In bash, the commands fc and history both display the history of recent commands; see the manual for available options. You can also navigate among past commands by pressing Up and Down, and search with Ctrl+R and ...


1

If you don't have zip and unzip packages installed and you have java, you can use jar to unzip: jar -xf file.zip


0

Press Ctrl+C to copy. When you paste into a terminal, what you'll get is the file name (with its full path). You get the raw file name, which won't be directly usable in a shell command if it contains spaces or other special characters. To use the file name in a command, don't use a paste command from the terminal, let the shell do the pasting. Install the ...


1

Click on it, press Ctrl+C and just paste it. If you use xclip -selection c w for pasting instead of Ctrl+Shift+V you won't get any file:// prefix or URL encoding. I recommend wrapping that into something more convenient to use and using it for manipulating the clipboard when you're in the terminal. Here's an article that discusses this method using the ...


4

Make a function: email_myself() { sudo mail -a "$1" -s "Subject of E-mail" myemail@gmail.com; } If you want your function to hang around permanently, and assuming that bash is your shell, add the definition as a line to your ~/.bashrc. For those who prefer shell scripts to functions, create a file named email_myself, make it executable (chmod +x ...


0

Use zsh and type what comes next. ZSH supports fuzzy auto complete and can deal with it. (Its especially nice with the OH-MY-ZSH plugin.)


1

After attaching your USB drive to a server, run in terminal lsblk, you will see all storage devices, that are attached to your machine. You may find there your USB drive (usually, they are named /dev/sdb or /dev/sdc, but is it NECESSARY to re-check that). After that, you have to mount it to have possibility to read/write, for example: mount /dev/sdb1 /mnt/ ...


1

First you need to connect your drive to the server. Second: type dmesg just after connecting, at the end you should see what the system "calls" the drive. Third: type mount to see if some automount mechanism already mounted the drive. If not, mount the drive manually with mount /dev/hdx /mountpoint


0

You could do something like... $ssh->enablePTY(); $ssh->exec('/path/to/daemon_adm.py'); $ssh->write('...'); echo $ssh->read();


1

To insert a string in a shell snippet and arrange for the shell to interpret the string literally, there are two relatively simple approaches: Surround the string with single quotes, and replace each single quote ' by the 4-character string '\''. Prefix each ASCII punctuation character with \ (you may prefix other characters as well), and replace newlines ...


2

ssh2::exec() returns a stream, which is connected to the stdin, stdout, and stderr of the remote command. So you can do: $command = '/path/to/daemon_adm.py'; $stream = $ssh->exec($command); fwrite($stream, "$text\n"); If you don't want to pass the parameters via stdin, you can use escapeshellarg(): $command = '/path/to/daemon_adm.py ' . ...


1

I don't use fish, but the documentation says that you can enter a Unicode character by prefixing its hex character code with \u (for 16-bit characters) or \U (for 32-bit characters). I think the code for ♫ is 491eb, so you could do: mv \U000491ebabc.mp3 abc.mp3 to rename ♫abc.mp3. Note that you need the leading zeroes, otherwise abc at the end will be ...


4

Rename symlinks One approach to handle file names with special characters - as first characters or elsewhere in the filename is to rename to simpler names. This can be used even if you need to keep the original filenames: Rename a copy of the filenames. That can be done by copying the files, but also by creating symlinks or hardlinks to the files, and ...


1

The accepted answer did not work for me but the following method did. However, if you have a directory that contains your LPD control files, typically it's /var/spool/cups, you'll notice a bunch of control files in there. These files are kept as a result of theMaxJobs` setting, which defaults to 500 when unset. $ sudo ls -l /var/spool/cups/ | wc -l 502 ...


1

I found the following 2 questions within the U&L site that would seem to give hints as a possible way to do this. These 2 questions: View all user's printing jobs from the command line How to show the CUPS printer jobs history? Would seem to imply that you could use lpstat to get what you want. I noticed that I could run this command: $ sudo ...


9

There are errors in your assumptions, but first some background: You should discern two uses of -exec: with \; the {} will be replaced by a single item found with + the {} will be replaced by many items (as many as the commandline can hold). Therefore your example of -exec use invokes as many cp command as items found by find. Using find ... -exec ...


3

Workaround using GNU parallel. parallel --nonall --sshloginfile .cluster --tag w In my case I use a file .cluster, which contains the hostnames where I want to run the command: $ cat .cluster n04 n05 n06 My output n04 11:19:43 up 110 days, 20:54, 2 users, load average: 0.16, 0.24, 0.25 n04 USER TTY FROM LOGIN@ IDLE JCPU ...


4

You can't use a terminal to create a file. You can use an application running in a terminal. Just invoke any non-GUI editor (emacs -nw, joe, nano, vi, vim, …). If you meant using the command line, then you are asking how to create a file using the shell. See What is the exact difference between a 'terminal', a 'shell', a 'tty' and a ...


0

Something helpful when you're stuck and must create a multiline textfile on the command line is something like this: # cat <<'EOF' > textfile > This "should" > prove useful, 'maybe'. > EOF # cat textfile This "should" prove useful, 'maybe'. You can substitute cat for another command, for instance grep and a pattern, and have grep do its ...


3

All it takes to create an empty file is: > my.txt


0

You can use either nano, vi or emacs editing program to create file on terminal level. If you're using x windows system you'll need to tell your system not to use the program in the GUI; but anyways, I'll use emacs as an example. From the bash; type: emacs filename.txt (press enter) - it will create an empty file with the filename specified ...


2

touch ~/Desktop/something.txt This will create an empty txt file. Or echo "Hello" > ~/Desktop/somethingelse.txt This will create a txt file saying "Hello". nano ~/Desktop/anotherfile.txt This will open ~/Desktop/anotherfile.txt in nano, or if it doesn't exist, it will create it and open it in nano. The same can be done by simply replacing nano ...


0

You didn’t say whether you want to keep these problematic filenames.  One solution might be to “fix” the problem once and for all by renaming (some or all of) your files to names that you can type by running this script: #!/bin/sh for old in * do printf "%s ...? " "$old" if read new && [ "$new" != "" ] then mv -i ...


6

ls has some switches (like --quote-name, --escape, --literal) for dealing with unprintable characters, but in this case it seems the character is "printable" but not "typeable" (at least on my keyboard!), so none of these switches seem to help. Therefore, as a general "brute force" approach to get rid of files with any characters in their names, you can do ...


4

The simplest that occurs to me is ls [^a-zA-Z0-9]* and it does the trick for me, but terdon's answer is better in bringing attention to the extglob shell option or even a shell-independent approach.


5

A similar approach would be to list all files that don't begin with "normal" characters. In bash you can do this with $ shopt -s extglob $ ls !([[:alpha:]]*) However, that does not seem to be available to fish, so you could use find instead: $ find . -type f -not -name '[[:alpha:]]*'



Top 50 recent answers are included