New answers tagged

2

Is there a way to tell if Ubuntu is running in recovery mode via terminal? From the webpage How to check a current runlevel of your Linux system: Debian distribution has it runlevel 2-5 dedicated to full multi-user with graphical managers and console login whereas Redhat/Fedora has two separate runlevels for each mode. To check the runlevel of you ...


2

for IF in *.* ; do OF="${IF%.*}.txt" ; mv -n $IF $OF ; done


0

You can write a script around /proc/net/dev, for instance: #!/bin/bash dev=$1 [[ -z $1 ]] && dev=$(grep -o "eth." /proc/net/dev | head -1) function getcount { echo $(grep $dev /proc/net/dev | tr ':' ' ' | tr -s ' ' | cut -d ' ' -f 3,11) } current=($(getcount)) [[ -z $current ]] && echo "No network device \"$dev\"" && ...


1

I use iftop. Install it (290 KB) with sudo apt-get install iftop and start with sudo iftop. Should you wish to monitor wireless internet traffic, use sudo iftop -i wlp3s0, where -i referes to interface, and wlp3s0 is my wireless interface (check yours by running lspci.


0

There are not too many tools that come built in, but here is a great page that as you read through the thread, you will find the ones that are already installed. How to display network traffic in terminal All of these only show the local traffic of the machine this is installed on, if you wanted to monitor your whole network, you would need to use the ...


0

I'd go with this option myself: ls -alR | grep -c ^-


0

This is because sudo meanwhile not works for many GUI based applications, use gksudo instead which you will find in the package gksu. So example: sudo apt-get install gksu gksudo emacs -mm apache2.conf & Happy hacking.


0

Okay I've got the answer, thanks rcs for the install method. Basically vegan requires previous installation of permute. So these commands do the trick: wget -O ~/downloads/permute_0.8-3.tar.gz "http://download.r-forge.r-project.org/src/contrib/permute_0.8-3.tar.gz" wget -O ~/downloads/vegan_2.3-5.tar.gz ...


0

Have you checked that the file on your system is at least the same size as on your friends'? This message is typical of truncated ZIP files.


0

Answering this in case someone runs into a similar problem The problem was with the lines export LD_LIBRARY_PATH=$LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/lib and export LD_LIBRARY_PATH=$LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/lib They should be export ...


4

.profile is run at login but a new terminal window is not a login and instead runs ~/.bashrc. if you log out of your session and login again your .profile will have the desired effect and your new terminal sessions after the login will inherit these settings from the initial login.


0

I believe you're asking about: How do I determine if my drivers are up-to-date on Ubuntu. For starters, you should post the results of lshw -short and nano /etc/os-release to provide hardware and OS information about your current build. Now, assuming I interpreted your question correctly, the first thing you want to do is make sure your applications are ...


0

The line: std::map <string, int> example; should be: std::map <std::string, int> example;


1

I believe that this will get you a list of every man page in section 8: apropos -s 8 . | less The option -s 8 restricts the search to section 8. Since the specified regex . matches anything, this should produce all the pages.


0

Simple way may be also just to run System Monitor (if started from Terminal you must write gnome-system-monitor) and under "Processes" tab arrange the running processes by Name and than count the number of occurrences of Bash in the listing (they will be all together if you arrange by name, so it's easy to count). Note that you must look for Bash and not ...


0

pdfimages -all returns the exact file that was stored in the pdf. We can test this by doing a round-trip: starting with a jpg image, we add it to a pdf using LaTeX, extract it using pdfimages -all, and then compare it to the original. (The reason for using LaTeX will be explained later.) I have the first jpg image as extracted from your link and I named ...


3

You have the stream redirection command in the wrong place. Redirections get parsed from right to left, therefore you need to first write the > /tmp/tmp.txt and then the 2>&1. As you wrote it, it first redirects STDOUT to the file and afterwards redirects STDERR to STDOUT. This is the correct command: sudo apt-get -qq -y --force-yes remove cowsay ...


0

you can add the line you want executed automatically to your .bashrc file. This script is run every time you turn your computer on and every time you open a new terminal window. open the file in a text editor gedit ~/.bashrc scroll to the very bottom of the file and type your command in xinput set-button-map 11 3 2 1 save the file and you're done.


3

This should work to make it stick after log in: Add the following command to startup Applications: /bin/bash -c "sleep 15 && xinput set-button-map 11 3 2 1" Open Dash > Startup Applications > Add, then add the command above. Explanation Adding a command to Startup Applications makes the command run on log in, so this will work from the moment ...


1

If you use zsh: zmv '(*).(*)' '${1:0:10}.$2' If it's not already done, you may need to first run: autoload zmv


0

Create a script in addition to an alias mentioned in the other answers. An alias by itself won't always work, and a script layer is fast enough for human readable output anyways. Choose a short name, like cgrep: #!/bin/sh grep --color -n "$@" Place it in your path, say ~/bin (if you read UPE this is in your path :). Then stuff like this will work: find ...


3

You can do with only bash: for FILE in *.jpg ; do mv "${FILE}" "${FILE:0:10}.jpg" ; done With a little work you can get file extension and add automagically to the new name.


12

You can try: rename -n 's/(.{10}).*(\.jpg)$/$1$2/' *.jpg Example: $ rename -n 's/(.{10}).*(\.jpg)$/$1$2/' *.jpg 11512345714x611aaa.jpg -> 1151234571.jpg 1201230111FbcAdee.jpg -> 1201230111.jpg 1208605001abAcd.jpg -> 1208605001.jpg The -n option only simulates the command, so that you can verify the changes. Run without it to actually make the ...


2

In the worst case, the flash drive has either a defect or has died. I bought three identical Patriot 32GB Supersonic drives from an online retailer and one of them was "write protected" out of the box. I went to the manufacturer's website and, after downloading and trying their own tool just to be sure, they granted an RMA without any fuss about it. I had ...


0

I ve been pulling my hair out with this issue for some time. In my case I am running Kali Linux as a Live CD in VirtualBox and want to change the screen resolution. :~$ xrandr --newmode "1200x900_60.00" 88.50 1200 1272 1392 1584 900 903 907 934 -hsync +vsync Then check if the mode has been added: :~$ xrandr Screen 0: minimum 64 x 64, current 640 x ...


1

Instead of setting PROMPT_COMMAND, as @waltinator suggested, you could embed the command into the actual prompt with process substitution: PS1='\u@\h\n$(showmem) \$ ' This PS1 is based on the one you mentioned in a comment, and uses the function that @waltinator made.


4

What did you try? You could define a function in your ~/.bashrc, thusly: function showmem() { free -m | tr -s ' ' '\t' | grep Mem: | cut -f3 } and then set Bash's PROMPT_COMMAND to that function PROMPT_COMMAND=showmem Remember to source ~/.bashrc whenever you change ~/.bashrc.


2

The option to set the terminal title has been deprecated in 16.04 LTS, however there is still a way to set the title. Edit your ~/.bashrc file and add the following lines: # function to set terminal title function set-title(){ if [[ -z "$ORIG" ]]; then ORIG=$PS1 fi TITLE="\[\e]2;$*\a\]" PS1=${ORIG}${TITLE} } After that close and reopen the ...


0

ctrl+shift+P works fine for me.


3

In fact what you posted there is called a fork bomb, because it does exactly that it is a bash function which calls itself twice and so on. You can replace the : with a name if you want so it becomes more obvious: fu{ fu | fu & }; fu So fucalls itself piping its output through itself again and this way fills up your processor with requests. It is ...


0

Simply type in sudo apt-get remove wine and let it uninstall wine. If there is a package in your machine that is truly installed called wine-staging-i simply type in sudo apt-get remove wine-staging-i and it will remove that package. If it claims that wine-staging-i is not apparent on your machine... it means it isn't. You can also use Systemback - A free ...


1

I don't believe there is a way, although there might be. I'm far more comfortable to suggest that you should check out some other terminal applications. Terminator is my favourite, it allows you to "split" a terminal with minimal borders and gives you 2 terminals in 1 window, makes everything look real nice. All have their advantages and disadvantages so do ...


1

There is no stdout in your example: wrapping a shell function definition in a script file and then calling the script does not execute the function. You need to either source the script so that the function becomes available in the current shell . Sourced/getFileSystemInfo getFileSystemInfo $(pwd) fstype,source or modify the script so that it calls the ...


0

Try sudo dd if=/dev/zero of=/dev/<device>. That will completely overwrite the drive with zeros. Then you can format it to FAT 32 or whatever using the Disks utility.


0

Yes, it is possible. Make two files, let's call the first one main.sh and the second one sub.sh. In main.sh put the following lines: #!/bin/bash gnome-terminal -x "./sub.sh" In sub.sh put the code you want to execute. Be sure to make both files executable. Then double-click main.sh.


0

you must create a file using your favourite text editor in the following fashion #!/bin/bash your commands here The first line (I believe it is called magic line) ensures that the following commands are executed in the shell. After creating this file you have to give it executable permission: right click on file -> properties -> permissions -> tick the ...


0

The already suggested methods might not work for some app (e.g. HipChat). I've had to do: xdg-settings set default-web-browser chromium-browser.desktop


0

I guess you are asking what are these errors? what should you do about them? Just to be clear: the errors aren't happening because you're running browsers from a terminal, you're just seeing the errors because of that. You've discovered that running a browser this way can be useful for debugging :) If your browsers run as expected and don't throw ...


0

Try: text="$(ls -la)" Note the quotation marks in the variable that contains the output. I hope it works for you!


2

Here ./testzenity: ligne 10: ls-al : commande introuvable it saying. No command like ls-la. it is ls -la. Hope it helps


0

I am confused by the headline of this post... Are you using Linux and want to install virtualbox, or are you using Windows 8.1 and want to install virtualbox? If using Windows, then correct sudo does not work, you want to download the windows file from here: https://www.virtualbox.org/wiki/Downloads and then just double click on the EXE to install it. If ...


0

I just tried your command and no joy, however if you do sudo ls -i you will get output. sudo cd does not work with the -i or not. What out-put are you looking for from the -i, especially from cd? cd is just to change directory, and has no real special power, ls does. From what I read here adding -i to sudo is for when you want to do sudo as another user. ...


1

This is how I got it working when running byobu Add this line in .bash_login before the "_byobu_source.." line: echo $DISPLAY > $HOME/.display.env And then add this line to .bashrc: export DISPLAY=$(cat $HOME/.display.env)


2

The -i option causes sudo to run the command in the shell specified by the target user's (in this case, root's) login shell, as you can confirm for example by running $ sudo -i sh -c 'echo $HOME' /root So it is telling you there is no Downloads directory in root's home. If you want to run commands as root but in the invoking user's environment, use sudo ...


2

To address booting into the command line, Edit /etc/default/grub with your favourite editor, e.g. nano: sudo nano /etc/default/grub Find this line: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" Change it to: GRUB_CMDLINE_LINUX_DEFAULT="text" Update GRUB: sudo update-grub For systems that use systemd, (This is an ...


2

1. You can add this line using nano or vim from terminal (ctrl+alt+t): sudo nano /etc/sysctl.conf where you then scroll down and add the line by hand then press ctrl+x to end editing. You will be asked if you want to save, confirm that by pressing y and then once return to save. Same way you can reverse your changes. 2. You can add it as well this ...


0

Have you tried sudo nano /etc/sysctl.conf at a command prompt?


0

As command substitutions are performed by the shell, you have to execute your command as an argument to the shell: gnome-terminal -x /bin/sh -c "youtube-dl --extract-audio --audio-quality 0 --audio-format mp3 $(xclip -o)"


0

Try Ctrl+Insert to copy (after selecting), Shift+Insert to paste.


0

Make sure that you do put space between cd and .. like this cd .. cd represents change directory. cd .. is used to go back from child directory to parent directory. You can check your current directory using pwd (present working directory). Type ls -l it will list all the files and directory. Use cd and you will be directed in specified directory. ...



Top 50 recent answers are included