Carlos Campderrós

less info
111 reputation
bio website
visits member for 2 years, 2 months
seen Apr 15 at 15:49

comment Can I make all commands have feedback if they've worked or not worked?
+1 for modifying PS1. This is the one I use, with red number in case of errors, nothing extra if last command succeeded: \[\033[01;41;37m\]${?#0}\[\033[00;01;36m\] \u@\h:\w\[\033[00m\]\$
comment What does the question mark in terminal command mean?
Standard wildcards are used by nearly any command (including mv, cp, rm and many others). => FALSE. these wildcards are being expanded by the shell and what the command receives is the result of the expansion (ie the files that match the pattern) instead of the pattern. (if there isn't any file that matches the pattern then that pattern will be passed directly to the command, though)
comment How do I iterate the arguments in a bash script?
if you need to work with options, you may find getopt useful.
comment How do I iterate the arguments in a bash script?
+1 I just want to note the importance of quoting "$@" for arguments that may have spaces because I've seen some people forgetting that and leading to unexpected bugs.
comment Shortcut to bring all open terminals to the front
"Screenshot will be taken in 1 second"... hmm someone just lied here...
comment What is the difference between dpkg and aptitude/apt-get?
Also, you can use gdebi (apt-get install gdebi-core) that mixes apt-get/aptitude with dpkg. You call it with gdebi some_package.deb and it will analyze its dependencies, call apt-get to install the missing ones and when all dependencies are fulfilled, then call dpkg to finally install your package.
comment How to use commands on files which have “-” at the start of their names?
For those programs that do not recognise -- the usual workaround is putting ./ in front of the file: pdfgrep ./-2013-01-01.pdf
comment What is the difference between `command` and `./command`?
@hguser if you run which xx and it tells you /usr/bin/xx, then executing xx or cd /usr/bin ; ./xx will do the same... except for aliases or shell functions. For example, ls and cd /bin ; ./ls will probably show differences (the first with colors, the second without colors). That is because probably ls is an alias to ls --color. You can find if xx is an alias or is calling an executable in the disk using type xx.
comment How to run a script every time internet connects
inside scripts in /etc/network/*.d/ you can use the variable $IFACE to know which interface is getting a connection so you can skip the procedure if it is the wired connection for example.
comment How do I create a script file for terminal commands?
@TC1 It's installed by default, so it doesn't matter if it's the default or not.