New answers tagged command-line
1
First, because you're about not to use terminal, I change sudo to gksu. And then, if you've created a script like this:
#!/bin/sh
gksu openvpn --config /home/ubuntu/Documents/vpnbook/vpnbook-euro2-udp25000.ovpn --auth-user-pass /home/ubuntu/Documents/vpnbook/password.txt
and named it your-script.sh, you can create a file like this (taken from this ...
0
If you're planning for this script to always execute in a windowed environment, and these messages are only used for rare errors, consider using xmessage or gmessage instead of echo. This will bring up a new window with the message, which the user can click to dismiss.
On the other hand, if the messages are common or frequent, you might want to always run ...
0
It looks like the important part of this question was already answered in the comments, but to address the root cause in case you're curious, I think ctrl-. doesn't work in a terminal because of some limitations of terminal emulators. In a standard terminal, ctrl is defined to send the ASCII code of the key you press minus 64 (this is why ctrl-J (74) sends ...
1
I found the solution here: http://stackoverflow.com/questions/9652126/bashrc-profile-is-not-loaded-on-new-tmux-session-or-window-why and here: http://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically
I needed to add source ~/.bashrc to the end of my .bash_profile.
0
There are two steps to this. First, you need to tell xterm to allow it to happen at all, because by default it ignores requests by hosted programs to resize the window. Add this to your ~/.Xdefaults:
xterm*allowWindowOps: true
For this to take effect, you either have to log out, or run:
xrdb ~/.Xdefaults
Then launch a new xterm, and in your bash ...
2
You become root with sudo su (as an example). Or better said: you elevate your admin user to admin priviliges permanently until you exit. Example:
rinzwind@discworld:~$ sudo su
[sudo] password for rinzwind:
root@discworld:/home/rinzwind#
And no Ubuntu technically does not have an active root user. From the Ubuntu RootSudo wiki page:
In Linux (and ...
3
sudo -i
This command will let you land at the root shell.
More explanation and comparison between other solutions here
corrupted by user's
HOME=/root uses root's PATH env vars
sudo -i Y Y[2] N
sudo -s N Y[2] ...
0
In 12.04, if you install a new desktop environment via terminal: e.g.
sudo apt-get install xfce4
During the installation the display manager pops up stating that you have more than one desktop environment but that you can only run one. It then asks you to select a default, so there's your opportunity.
I can't find a way to do it without having to ...
0
I'm doing:
( sysctl vm.swappiness=10 ) > /dev/null
if [[ `grep "vm.swappiness=" /etc/sysctl.conf | wc -l` -eq 0 ]]; then
echo "vm.swappiness=60" >> /etc/sysctl.conf
fi
sed -i -r 's~^vm.swappiness[[:blank:]]*=[[:blank:]]*[0-9]*$~vm.swappiness=10~' /etc/sysctl.conf
1
Why not
bzcat file | tee no_modifications | sed blah blah
?
This would decompress, tee (or split the data) into a file call no_modifications and stdout which you pipe into sed for "immediate use".
If you really want to delete the original then I'm afraid you're down to
bzcat file | tee no_modifications | sed blah blah && rm file
0
From your description I get the feeling that there is something wrong with how or where the system has mounted the external disk.
Please note that it is not recommended to mount storage devices to folders that are not empty, so make sure of that (detach drive, check if folder is empty and if not empty it, then reattach drive) If this does not solve your ...
0
Using cp -b will make a backup of the destination files, i.e. where you are copying to.
I do not think you are trying to do this?
The most common use is by using -R, which allows a recursive copy of the source to the destination. Perhaps this would be more appropriate?
You might also consider using rsync (i.e. rsync -avz $SRC $DST --delete), which would ...
1
Open Gnome Terminal
Click on Edit -> Profile Preferences
Go to Title and Command tab
Check Run a custom command instead of my shell
Set your Custom command to
/usr/bin/byobu
Full disclosure: I'm the author and maintainer of Byobu.
1
This sounds like a trick for dd.
Do this :
sudo dd if=/dev/sda1 of=/dev/sdb1
dd (disk dump) is better for creating backups
The if options specifies what is to be copied and the of option specifies where it is to be copied.
0
What you want is the -r command. So your command would be:
cp /dev/sda1 /dev/sdb1 -r
-r means recursive, or "this folder, and everything in it".
Also, if you're trying to copy your root partition, it's likely you'll get a "permission denied" error. In that case, you'll need sudo in front of the command:
sudo cp /dev/sda1 /dev/sdb1 -r
0
I was looking how to create custom commands and I found this question among others. I think what I was looking for was for aliases so I'll give you the way to do this with an alias.
On your home folder:
$ sudo nano .bash_aliases
And there you can write down your commands in one line:
alias start-working='sudo service apache2 start; sudo service mysql ...
1
tcpdump -i eth0
That will give you a streaming information of all the data flowing from that interface (your ethernet card). Similar to wireshark.
Use ifconfig to see a list of your machines interfaces.
0
There is a similar question on stackoverflow: How to automate download and instalation of Java JDK on Linux?
The answer using wget is:
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz"
The last argument is the url to download from. Different java version ...
0
The following script does what you asked:
#!/usr/bin/perl
my $user="user";
my $encrypted;
my $userno=1;
my $userstogenerate=6;
sub encryptingPsw {
my $psw = shift;
my $count = shift;
my @salt = ('.', '/', 'a'..'z', 'A'..'Z', '0'..'9');
my $salt = "";
$salt.= $salt[rand(63)] foreach(1..$count);
crypt($psw, $salt);
}
for ...
0
I found what it is. It's the Use compositing which I have enabled in my desktop settings. When I had that disabled in showed my desktop background now, but applications don't have that transparency in the backgrounds anymore.
0
What you described is the proper way Guake should function. Are you sure it formerly would not show the top-most item and your background instead? There is no setting to change this so that it only shows your background and not the top-most item, but you can suggest it on the website (guake.org) or on their Github page (github.com/Guake/guake).
1
If you use bash, you can add the following to your ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
If you use zsh, you can add the following to your ~/.zshrc
bindkey "^[[A" history-search-backward
bindkey "^[[B" history-search-forward
0
I had to create a bash script
echo "${@}" | xclip -i -selection "clip-board"
and call it from the Now playing plugin
bash /home/ian/scripts/gmb-np.sh "%a - %t (from %l, %y)"
0
There's no "command roll back". If you have the commands you can undo them one at a time by just doing the reverse. But in short, keep backups, learn to read all directions before you do ANYTHING specially with root permissions (sudo) and don't blindly copy and paste commands from websites. If you don't know what it does then don't do it. Specially where ...
0
Are you using kerberos? I had the same problem when made this change in /etc/krb5.conf...
[libdefaults]
default_realm = MYREALM
dns_lookup_realm = true
...to...
[libdefaults]
default_realm = MYREALM
dns_lookup_realm = false
I was having problems with firefox hanging, and I thought that might be the solution. Rebooting didn't fix the "ps hanging" ...
1
Try terminator?
Free? ✓
Logging? ✓
Key binding? ✓
etc, etc....
0
You can install this Add-on: https://github.com/bard/mozrepl/wiki and enable it with Tools->MozRepl->Start. After that you can script Firefox from outside. Create following test.js file:
window.getBrowser().removeCurrentTab()
repl.quit()
And run it following way:
nc localhost 4242 < test.js
-1
Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
xkill
and click on the tab you want to close.
1
I'm developing a cross-platform desktop application that lets you rename a set of files from a specified pattern to another one. User can specify both of the patterns.
You can download it from this link (it's called: file-renamer-swt). And here is the project main site.
0
I had the similar question, until I found this.
http://blog.e-thang.net/2012/08/14/tmux-and-bash-tab-completion/
Pretty good, colorful, explanation.
Reference:
/usr/share/byobu/keybindings/f-keys.tmux
/usr/share/byobu/keybindings/f-keys.tmux.disable
2
The previous answer is technically accurate, but I think is circumventing the user's overall knowledge of what they were trying to do. Let's focus on what you did wrong, and then rewrite the command so you can actually find the entries of ">" in the file instead.
(Explanation of why the file got dumped)
If you use > at the end of a line (try "ls > ...
3
You're looking at output redirection (Bash). By redirecting the regular output 'stdout' to filename, you're overwriting it. Error output, 'stderr' is still shown (in your terminal by default), though. That was the help text you saw.
To actually use the > character in grep as a character to match on, escape it in your shell (Bash), e.g.
grep -c \> ...
1
I developed a simple ping-based nodejs script that tests the servers listed on mirrors.ubuntu.com/mirrors.txt and returns the fastest one:
sudo npm install -g ffum
ffum
Please let me know if you find it useful or have any suggestions (=
2
Using PHP you can try the following command:
$ echo oil+and+gas | php -r 'echo urldecode(fgets(STDIN));'
oil and gas
or just:
php -r 'echo urldecode("oil+and+gas");'
Use -R for multiple line input.
0
flvmeta is a command line tool available for Windows, Mac and Linux that can add metadata (in the form of a string) to flv files
Basic usage:
flvmeta --add=NAME=VALUE inputfile.flv outputfile.flv
(replace NAME and VALUE with your values)
You can check whether the metadata has been added by running
flvmeta -m outputfile.flv
1
If it locks up completely, you can REISUB it, which is a safer alternative to just cold rebooting the computer.
REISUB by:
While holding Alt and the SysReq(Print Screen) keys, type R E I S U B.
R: Switch to XLATE mode
E: Send Terminate signal to all processes except for init
I: Send Kill signal to all processes except for init
S: Sync all mounted ...
1
PiTiVi - allows users to easily edit audio/video projects based on the GStreamer framework. PiTIVi provides several ways of creating and modifying a timeline. Ranging from a simple synopsis view (a-la iMovie) to the full-blown editing view (aka Complex View) which puts you in complete control of your editing.
For install it from a terminal, use next ...
0
You can just pipe it like:
<your command> | espeak
1
I don't particularly care for that guide they give, you should not need Samba just to log in. Here is a somewhat better guide in my opinion.
Also, do note that when you log in, you will now have to log in as domain\username not just the username and you won't get a new log in screen just so you know. The log in screen will look exactly the same, this only ...
2
After some of my own research, and some fiddling around, this is the solution I have found for myself:
grep security /etc/apt/sources.list > /tmp/su.list
apt-get -o Dir::Etc::Sourcelist=/tmp/su.list -q update
apt-get -o Dir::Etc::Sourcelist=/tmp/su.list -q upgrade -s 2>&1 | tee /tmp/security_updates_fetch.log
apt-get -o ...
0
You could also get around the problem by setting
stty erase '^?'
Here are some details about the deviant behavior of certain terminal emulators (which is by the way why certain emulators have this problem): Linux Backspace/Delete mini-HOWTO.
0
Note: I've added this answer at a later date, because none of the existing answers address a crucial aspects regarding ssh, and will give misleading values to those who follow the above instructions.
Use X-forwarding when ssh-ing. This is enabled with ssh -X.
Without x-forwarding:
$ ssh MYCOMP
$ glxinfo
Error: unable to open display
With x-forwarding:
...
1
You can do that with su or sudo, no need for both.
sudo -H -u otheruser bash -c 'echo "I am $USER, with uid $UID"'
The relevant parts of man sudo:
-H The -H (HOME) option requests that the security policy set
the HOME environment variable to the home directory of the
target user (root by default) as ...
0
Okay, I'm going to try and answer your question, even though there is no terminal output included in your question.
The command ifconfig wlan0 does not turn on your wireless card. It gives you information about your wlan0. To turn on your wireless card, you would enter ifconfig wlan0 up. Although, it's not always wlan0. To find out the name of your ...
0
Check out terminology, the console from Enlightenment. It's capable of what you are asking...see this video:
http://www.enlightenment.org/p.php?p=about/terminology
Not sure how much is capable outside of Enlightenment, but they have a ppa for it.
https://launchpad.net/~efl/+archive/trunk
0
i use wvdial to connect to my 3g modem as below:
install wvdial :
sudo apt-get install wvdial
edit the wvdial.comf file by any text editor say gedit by below command:
sudo gedit /etc/wvdial.conf
copy paste the following lines in wvdial.conf
[Dialer a]
Modem Type = Analog Modem
Phone = *99#
ISDN = 0
Baud = 460800
Username = " "
Password = " "
Modem ...
1
Generally the first thing I do in situations like that is checking ctrl+alt+t. If it works I can just type xkill and choose the application that causes trouble. If I cannot click it I use killall <name of application>, but it does not always work. Sometimes I need to first get the process number by ps x | grep <at least partial name of ...
1
Also, on most systems, typing testparm will give you info about the samba shares of the machine you're currently using. After you press enter at the prompt it'll also show you every uncommented line of smb.conf which can be useful.
1
You should be able to do ssh -t user@host some_other_shell, where some_other_shell is something like sh, ksh, zsh, etc.
0
Explaination on why to use ~Bob/
Usually on your own Linux computer you use ~/ for your Home directory. The reason for this is that we usually assume you are logged in as the user you are using, and typing ~/ will take you to the home of the user you are logged in as.
So some situations using ~/ or just ~ will not work.
Logged in as root
Logged in as ...
Top 50 recent answers are included






