Tag Info

Hot answers tagged

47

just type: alias gb='cd /media/Dan/evolution' To make this setting permanent (so that it sticks after you restart or open another console) add this line to the file ~/.bashrc (assuming you use the bash as your default shell)


34

Alternative to aliasing gb() { cd /media/Dan/evolution; } This defines shell function gb, which takes no arguments, and performs cd /media/Dan/evolution. As with other suggeststions, this can be added to ~/.bashrc


22

You can use brace expansions: convert -trim -density 400 this_is_a_very_long_filename_of_my_pdf_file.{pdf,png}


15

Easy trick for alias in $(compgen -a); do type $alias; done


12

It is possible, and alias is the command you're looking for. For example alias ll="ls -l" in bash will let you type ll instead of ls -l. Please note there are no spaces used when setting an alias. man alias can be useful as well.


9

You can type: $ cat very-long-filename.ext1Ctrl+WCtrl+Y>Ctrl+YBackspace2 Or: $ cat very-long-filename.Ctrl+WCtrl+Yext1>Ctrl+Yext2 To really use brace expansion, note that: cat a.ext1 > a.ext2 Can also be written: cat > a.ext2 a.ext1 However you cannot do: cat > a.ext{2,1} However, you could do: eval cat \> a.ext{2,1}


9

The best way to do this is a Dynamic Range Compressor. Audacity has one built-in, under "Filters->Compressor." This is, essentially, a program that removes the range between quiet sounds and loud sounds. It's surprisingly easy to use. Set the "Threshold" value to something very low. Set the "Noise floor" to around -30DB. Set the ratio to a very high ...


9

mimeopen -a 'picture.jpg' This is what you need It will give you output like this Please choose an application 1) Shotwell Viewer (shotwell-viewer) 2) Firefox Web Browser (firefox) 3) Image Viewer (eog)


8

For a standard "box around a message", use boxes: echo 'This is a test' | boxes boxes will look like this (First one. Second one is a custom like cowsay): If you mean an alert box, use notify-send: notify-send 'title' 'message' notify-send looks like this: You also can use zenity for a popup window: zenity --error --text="An error ...


7

You can almost definitely just do: alias >>./bash_aliases


6

With grep, you can do: $ grep -vwF -f toremove.txt users.txt username, userid, sidebar_side, sidebar_colour "John Lennon", 90123412, "left", "blue" "George Harrison", 72349482, "left", "green" With awk: $ awk -F'[ ,]' 'FNR==NR{a[$1];next} !($4 in a)' toremove.txt users.txt username, userid, sidebar_side, sidebar_colour "John Lennon", 90123412, "left", ...


5

The classic standard for this is from POSIX, Utility Argument Syntax (thanks to @illuminÉ for the updated link). It describes the syntax to be used in man pages, for example utility_name[-a][-b][-c option_argument] [-d|-e][-f[option_argument]][operand...] Being classic, it recommends using single-character options, with -W recommended for use by ...


5

Your folder can have some hidden files (ls doesn't show dot files by default, i.e. files whose name begins with . are hidden). Run: ls -la gamesForAdmin to check if there is any hidden files in it. Updated According to your result ls -la, your directory is not empty, so rmdir can not remove it, rmdir only work with empty directory. To remove it, you ...


5

Edit in response to updated question Since you only care about links, directories and regular files, and don't need to deal with the other filetypes that ls can identify (FIFOs, sockets etc), you could do something like stat. For the examples below, I have created the following test environment: $ ls -l total 4.0K -rw-r--r-- 1 terdon terdon 0 Jun 30 ...


5

Take a look at sox Quoting man sox: SoX - Sound eXchange, the Swiss Army knife of audio manipulation [...] SoX is a command-line audio processing tool, particularly suited to making quick, simple edits and to batch processing. If you need an interactive, graphical audio editor, use audacity(1). So, it should be a nice fit as a companion ...


5

If you always use the same command with small variations (such as the file name), you can write a function: pdf2png() { convert -trim -density 400 "$1" "$1:r.png" } (this function is specific to zsh), and for each file your_file.pdf you want to convert: pdf2png your_file.pdf Note 1: You can write the same kind of function for other shells, but this is ...


5

You need an interactive shell for alias definitions: bash -i -c "alias"


5

I assume you've inadvertently trimmed the important part of your command lines out here: the URLs in question contain a ? character (or a *). ? and * are special glob matching characters to the shell. ? matches a single character in a filename, and * matches many. When zsh says: zsh: no matches found: http://myvideosite.com?video=123 it's telling you that ...


4

To list available valid login shells for use at time, type following command: cat /etc/shells Example: pandya@pandya-desktop:~$ cat /etc/shells # /etc/shells: valid login shells /bin/sh /bin/dash /bin/bash /bin/rbash /bin/ksh93 For information about shell visit wikipedia.


4

nmcli c up uuid "$(nmcli -t -f uuid c)" Use backticks or $(cmd) for commmand substitution Note that nmcli -t -f uuid c can print out more than one uuid. I didn't test it yet, but the command above might not work then. If so, you should make sure that you are using the right uuid like that: nmcli c up uuid `nmcli -t -f name,uuid c | awk -F':' ...


4

This call to mogrify will create a new png file instead of overwriting the pdf - hopefully ;) mogrify -trim density 400 -format png th*.pdf for th*.pdf use the aprropriate number of characters to select the right file or better tab completion until you have the full name. This way you can make an alias to the whole command up to the png parameter.


4

You started writing a string literal: everything between ' and the next ' is treated as a single "thing" by the shell, including newlines, spaces, and any other characters. Here you wrote a string containing two newlines. That meant that the first thing on the line was \n\n (two newlines). Because the first thing on a line is always the command to run, the ...


4

The curses program tabs will allow you to change what the terminal believes to be the width of a ^I. This would make a simple script tabs -4 cat "$@" tabs -8 However, the processing of tab characters on terminals is notoriously wonky and I'm of the impression that you should never mess with them. I suggest using expand as in: expand -4 "$@" which is ...


4

From the ping manpage (emphasis mine): When the specified number of packets have been sent (and received) or if the program is terminated with a SIGINT, a brief summary is displayed. Shorter current statistics can be obtained without termination of process with signal SIGQUIT. So this will work if you're fine with your stats being slightly less ...


4

getent group somegroupname || groupadd somegroupname


3

Based on the output you're showing in your question the directory gamesForAdmin is not empty, so rmdir cannot remove this directory. To remove it you'll need to use rm -fr instead. Try this: sudo rm -rf gamesForAdmin which should fix you right up.


3

Consider using variables to store your filenames. They autocomplete too: f="this_is_a_very_long_filename_of_my_pdf_file" convert -trim -density 400 "$f.pdf" "$f.png" I use quotes because sometimes spaces bite. Significant benefits of this are: You can perform further operations with the value in $f, knowing it points to the right file It is the ...


3

You should be able to use tr, but not as specified on the page your link points to as that includes the removal of newline and carriage return. What you should do is: tr -d " \t" < infile.txt > outfile.txt


3

You can pass the [[:blank:]] character class to tr to delete spaces and tabs but retain newlines <file tr -d '[[:blank:]]'


3

You can use info command to know more details about any command in coreutils. Here is some portion in info ls, explain the -l option: `-l' `--format=long' `--format=verbose' In addition to the name of each file, print the file type, file mode bits, number of hard links, owner name, group name, size, and timestamp (*note Formatting file ...



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