Tag Info

Hot answers tagged

19

command is a bash builtin as we can see: seth@host:~$ type command command is a shell builtin So we know command is provided by our shell, bash. Digging into man bash we can see what its use is: (from man bash): command [-pVv] command [arg ...] Run command with args suppressing the normal shell function lookup. ...


18

You can pipe the output of tail -f to head to limit the amount of lines shown: tail -f [PATH] | head -n 100 to only show 100 lines in total.


12

I think you're looking for the Alt-Backspace shortcut.


8

There are two ways to interpret this question; I'll address both cases. You might want to display lines: that contain a sequence of four digits that is itself not part of any longer sequence of digits, or that contains a four-digit sequence but no longer sequence of digits (not even separately). For example, (1) would display 1234a56789, but (2) ...


8

echo -e and echo $'...' are both similar in that they support the following escape sequences: \a alert (bell) \b backspace \e \E an escape character \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \\ backslash \0nnn the eight-bit character whose value is the octal value ...


4

vim [your file] If this isn't working for you, make sure you have it installed with: sudo apt-get install vim If you're already IN vim do :edit [your file]


4

To detect the readline binding that kill a word backward as you wish you can use the following command in your terminal: bind -p | awk '/kill/ && /word/ && /backward/' In a default Ubuntu installation, the output could be: "\e\C-h": backward-kill-word # shell-backward-kill-word (not bound) The second line seems without importance at ...


4

New lines only With the plain tail -f, the first 10 lines are from the file as it already exists: tail -f file.log | head -30 writes 10 lines of log.txt when it is run, and 20 (n-10) lines that are added later. With a log file, you normally use -f (--follow) to see the lines written in the future. To see only the 30 lines that where written after tail ...


3

If your photo is named file.jpg and you want to back it up to a file named after the date, then run: cp file.jpg "$(date '+%Y%m%d%H%M').jpg" If the back-up files go in a different directory: cp file.jpg "/path/to/backups/$(date '+%Y%m%d%H%M').jpg" If, instead of backing it up, you wanted to rename the file, then use mv in place of cp: mv file.jpg ...


3

If you need a one-liner then this should work: cp photo.jpg "/path/to/backup/folder/$(date +%Y%m%d%H%M).jpg" Otherwise I'd recommend storing the date in a variable then calling the cp command. date=$(date +%Y%m%d%H%M) cp "$source" "/path/${date}.jpg"


3

It has two different uses: One use is to ignore aliases and functions, and run the executable file found in PATH, even when an alias or a function with the same name exists. As example, I'll use an alias for ls that appends a / to directory names: $ alias ls='ls --classify' $ ls -d . ./ $ command ls -d . . In an interactive shell, it may be more ...


3

The Software Update application is just a GUI frontend to the apt and dpkg backends in the command line, which actually maintain and manage the packages. The ultimate underlying commands being run are about equivalent to sudo apt-get update when you hit "Refresh" or "Check for Updates". The about-equivalent command being run when you have all the packages ...


3

Try htop: sudo apt-get install htop htop It has a tree view (F5) and can show all user and kernel threads (shift+H and shift+K).


3

dpkg is not appropriate in your case, prefer the dpkg-query command instead. With the dpkg-query you can select the type of fields you want (and optionally the separator): $ dpkg-query -W -f='${binary:Package}\t${Version}\t${Architecture}\t${binary:Summary}\n' grep grep 2.16-1 amd64 GNU grep, egrep and fgrep See the dpkg-query man page for more ...


2

As long as you have php installed, you run a PHP file using /usr/bin/php /path/to/php/file.php Or if your $PATH is set up properly to include /usr/bin, then simply php /path/to/php/file.php You can check if PHP is installed, by running which php


2

You can find where most executables are using "which": ~$ which reboot /sbin/reboot You can make an alias using "alias": ~$ alias rbt="reboot"


2

Type sudo update-alternatives --config editor You will get a text like below. There are 4 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ * 0 /bin/nano 40 auto mode 1 /bin/ed ...


2

Both in background: ~$ (sleep 1 &) && (sleep 2 &) ~$ 1st in background ~$ (sleep 1 &) && (sleep 2) ~$ wont work with apt-get though. edit: found it. sudo bash -c 'apt-get update >/dev/null 2>&1 & disown' && sudo apt-get upgrade Proof: sudo bash -c 'apt-get update >/dev/null 2>&1 & ...


2

Press Ctrl+U to "cut" the command you were writing (actually, everything that is before the cursor). Then, later, press Ctrl+Y to "paste" that command.


2

A quick way would be to add the following lines to a script called .pythonstartup.py and put it in your home directory: import rlcompleter, readline readline.parse_and_bind('tab:complete') Then add the following line to your .bashrc: export PYTHONSTARTUP="/home/YOUR_USERNAME/.pythonstartup.py" Note 1: The .bashrc file is usually located in your home ...


2

The script that you dropped into /usr/local is not a usable netbeans application but rather an install script for it. Move it back into your home directory somewhere and following the installation instructions found here: Netbeans IDE - Installation Instructions


2

Try using the perl-based rename command e.g. rename -n -v -- 's/tsb_p[.]mp3_\d+//' *.mp3 It will not actually rename your files until you remove the -n (no-operation) switch.


2

There are a few options. The least intrusive is to start the terminal by pressing Alt+F2 and running the command env LC_TIME=en_US.UTF-8 gnome-terminal


2

The -V option is not meant to be used with the update command. Only upgrade or install allow this option: Quite a while ago I wanted to ability to show the versions of packages as they get upgraded. It makes a great deal of difference to me if a package is updating from 1-3 to 1-4 vrs 1-3 to 2-1. The attached patch provides an option to print ...


1

Simply create a .desktop file and save it in ~/.local/share/applications. In its most basic form: [Desktop Entry] Name=name_of_your_script_like_you_see_it_in_Dash Exec=sh /path/to/script.sh Icon=/path/to/some/icon Type=Application Copy it into an empty file, save it as script.desktop in ~/.local/share/applications. After log out /in, it will appear in ...


1

Open System Settings. Click on Software Sources. Remove check for the cdrom. Select the Other Software tab. Remove the check boxes for the sun-java PPA.


1

Try it with this command instead: gnome-terminal -e "bash -c 'vnstat -ru -i wlan0 -h; exec bash'" The exec bash part at the end causes to start a bash that replaces the current shell (also a bash).


1

/usr/local/ itself isn't in the default path, /usr/local/bin is. Move your launch script there and it should be picked up. In your case, you're installing the entire thing into /usr/local/netbeans-<VERSION>/. This includes a launcher script in ./bin/netbeans. The simple fix for you is to just symlink to that launcher from somewhere in the path: ...


1

if you have Document Viewer installed type the following command: evince Name_of_pdf_file


1

When the shell encounters text enclosed in $( ), it: Takes it to be a command and (as bodhi.zazen says) runs the command in a subshell. Substitutes the output of the command, in place of the entire expression (including the opening $( and closing )). As heartsmagic's answer explains, this is one of two available syntaxes for command substitution. "What ...



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