Tag Info

Hot answers tagged

9

gzip or bzip2 will compress the file and remove the non-compressed one automatically (this is their default behaviour). However, keep in mind that while the compressing process, both files will exists. If you want to compress log files (ie: files containing text), you may prefer bzip2, since it has a better ratio for text files. bzip2 -9 myfile # ...


8

Check out transmission-cli. The usage is as simple as running transmission-cli <torrent-file>, but you can obviously tune it to your needs with several options. Just a side comment: Actually you could use many other options, apart from transmission-cli and there will probably appear many other suggestions here (like deluge by Benjamin B. in the ...


6

# ./run > /dev/null This redirects stdout to /dev/null, but it doesn't do anything at all with stderr. Since you asked to redirect form stdout and stderr, this does not do what you want. # ./run > /dev/null 1>&2 This redirects tdout to /dev/null, and then it redirects stdout again (1>) to wherever stderr points to (&2) which is ...


6

Try: cat /sys/class/net/eth0/speed I'm not sure what you mean by primary interface. On a host with an IPv4 stack, you could retrieve the interface where the first default route is with: ip route show 0/0 | grep -Pom1 'dev +\K[^ ]+' (assuming GNU grep). So: cat "/sys/class/net/$(ip route show 0/0 | grep -Pom1 'dev +\K[^ ]+')/speed" Not all IPv4 ...


6

Here's a conceptual approach that might work. The alias command generates a list of all aliases, each followed by an = and it's definition. This output could be parsed by extracting the alias name from between the first blank and the first =. Everything after the first = would be the definition to be matched against. This sounds like something easily ...


5

The standard (POSIX) syntax is: kill -s STOP "$pid" That is, without the SIG prefix. Some shell implementations, support kill -s SIGSTOP or kill -SIGSTOP as an extension but that's not standard nor portable. The Unix specification (POSIX+XSI) also allows: kill -STOP "$pid" And kill -19 "$pid" Though which signal number is SIGSTOP is not specified ...


5

It's all about metaphors for communication. GUIs are picture books - they let you move things to other things, or right click on things and select options. But you still type a post when you want to ask a question. Command lines are much the same thing - they're about telling a computer what to do. If what you're trying to do is simple, then pictures and ...


5

I figured out a tar solution by myself. It deletes single file after compressed it into the target file. The compressing speed is not quite fast, though. The command looks like: tar -zcvf my_log.tar.gz *.log --remove-files


4

You can also try rtorrent and may be ctorrent which man page starts with: ctorrent - Download bittorrent files from command line


4

Probably a limit of the terminal device line discipline internal line editor buffer. You should be able to enter long lines by pressing Ctrl+D in the middle of it (so the currently entered part be sent to cat and the line editor flushed), or by disabling that line editor altogether. For instance, if using zsh: STTY=-icanon cat > file Note that then ...


3

You can use this if you are on a little endian system: iconv -f utf-8 -t ucs-4le | od -tx4 or this if you are on a big endian system: iconv -f utf-8 -t ucs-4be | od -tx4


3

Perl module Unicode::Tussle comes with a very useful script named rename (which is unfortunate, because the name clashes with the standard rename(1) on Linux). With it, you could do something like this: mkdir xyz find . -name '*.pdf' -print0 | \ rename -0 's!^\.!xyz!; s!/[^/]*\.pdf$!.pdf!' Without Perl, you could still do the same thing with a bit ...


3

Would something like the following be OK? This assumes bash (for brace expansion) and GNU parallel. parallel -N0 -j0 -u yes ::: {1..10} The -j0 setting is there to make sure as many processes as parameters get started, and -u (ungroup) is there so that the output of each process is printed as soon as it is available (this matters in the case of yes, since ...


3

Use pkill: pkill blob That would kill all processes matching the pattern blob. Another approach would be killall, but you should call it with -r so that the pattern is interpreted as a regex: killall -r blob


3

This answer is not the most-specific for the user's question Please see my 2nd answer. I am leaving this here because it addresses the more general issue. Per the comments to your original post, you need (1) a terminal emulator which supports bracketed paste and (2) corresponding support for whatever is running in the terminal, ie, vim, bash, zsh. Terminal ...


3

Why doesn't the shell open like it did in the first case? In the first case, stdin is a terminal and the shell is interactive. It waits for your commands etc. In the second case stdin is a pipe, and the shell is non-interactive. Your program consumes the first line on stdin (namely the string test\n), then the shell tries to read stdin and sees ...


3

1. find . -type f -name 'Simplex*.csv' -print0 | xargs -0 cat > looksee.txt From man xargs --null -0 Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken literally). Disables the end of file string, which is treated like any other ...


3

grep can't do this for file in one certain directory if you have more files with the same name in different directories, use find instead: find . -type f \! -path './test/main.cpp' -exec grep pattern {} \+


3

I don't think it's possible with GNU grep. You don't need pipes though. With find: find . ! -path ./test/main.cpp -type f -exec grep pattern {} + With zsh: grep pattern ./**/*~./test/main.cpp(.) (excludes hidden files, just as well to exclude the .git, .svn...).


3

Whatever you're saying about ~$, home$, and /home$ doesn't make much sense.  I guess you're talking about your command line prompt; if so, it would have been useful to show what you typed and what happened (and then explained what you expected). But I can read minds, so I believe that I understand the issue: ~ and ~user239887 (assuming user239887 is your ...


2

If you want to check your pop3 mail accounts then take a look at the following terminal mail clients: pine alpine mutt There are many more, but those are the most popular ones that I know of.


2

You want it to be 2 or 3 arguments to find: ("-o"), "-name" and "$2", so that's: mopt=false case $1 in ... -m|--mask-file) "$mopt" || mask+=(-o) mask+=(-name "$2") mopt=true shift 2;; find . "${mask[@]}"


2

@dhag certainly has a one-line answer, but the syntax makes my eyes hurt. :) Since you asked for a single command, and since the shell considers for-do-done a single (compound) command, I feel justified with this much more readable version: for i in {1..10}; do yes &; done Note that some shells automatically nice(2) background jobs, so if that's an ...


2

If you only want the process ids, why not use pgrep: pgrep -u root init Or: pgrep -U root init Which switch you use (-u/-U) depends on what you want. The difference is, -u matches the effective uid and -U the real uid: The effective uid describes the user whose file access permissions are used by the process. The real uid is from the user who created ...


2

You can use telnet to connect to the mail server and talk POP3 to check your credentials: $ telnet pop.gmx.net 110 Trying 212.227.17.185... Connected to pop.gmx.net. Escape character is '^]'. +OK POP server ready H migmx028 0MAbjW-1YwF4D0ml8-00BiVl USER spamaccount80@gmx.de +OK password required for user "spamaccount80@gmx.de" PASS typeyourpassword -ERR ...


2

Assume you are in parent directory of sub directories: find . -type f -name '*.out' -exec sh -c ' for f do grep "string" /dev/null "$f" | tail -n 1 done ' sh {} +


2

PDF is not exactly plain text file. So you should create text file and then convert it to pdf. First command create PS file from text file. Second get this PS file and create pdf file a2ps <text filename> ps2pdf <ps filename>


2

Welcome to Linux! A trick that will get you started here (and will save you from getting carpal tunnel in the future) is "tab completion": $ ls /med then press Tab to see $ ls /media/ If you press Tab again, you might see a list of possible options to continue the path, $ ls /media/ MyBigExternalDrive/ My Example Hard Drive/ or (if there is only ...


2

Use find: find /path -mtime +180 -size +1G -mtime means search for modification times that are greater than 180 days (+180). And the -size parameter searches for files greater than 1GB.


2

You could use xkill, xdotool or wmctl. type xkill on the terminal and then click on the window you want to close.



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