Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
***
cat /etc/passwd
***
OR
***
less /etc/passwd
more /etc/passwd
***
You can also use awk:awk
***
awk -F':' '{ print $1}' /etc/passwd
***
3 years ago
Type man tar for more information, but this command should do the trick:
***
tar -xvzf community_images.tar.gz
***
To explain a little further, tar collected all the files into one package, community_images.tar. The gzip program applied compression, hence the gz extension. So the command does a couple things:

f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
z: tells tar to decompress the archive using gzip
x: tar can collect files or extract them. x does the latter.
v: makes tar talk a lot. Verbose output shows you all the files being extracted.
To extract into a custom folder, add the -C option with a folder name of your choice:

tar -xvzf community_images.tar.gz -C some_custom_folder_name
3 years ago
copy the file /var/lib/apt/extended_states, which is a text file database in this format:
***
Package: grub-common
Architecture: amd64
Auto-Installed: 0

Package: linux-headers-2.6.35-22-generic
Architecture: amd64
Auto-Installed: 1
***
Auto-Installed: 0 indicates that the package was expressly installed and is not just a dependency.
3 years ago
If the unzip command isn't already installed on your system, then run:
***
sudo apt-get install unzip
***
After installing the unzip utility, if you want to extract to a particular destination folder, you can use:
***
unzip file.zip -d destination_folder
***
If the source and destination directories are the same, you can simply do:
***
unzip file.zip
***
3 years ago
There are a number of options:

Use the --remove flag, similar to how the PPA was added:
***
sudo add-apt-repository --remove ppa:whatever/ppa
***
You can also remove PPAs by deleting the .list files from /etc/apt/sources.list.d directory.

As a safer alternative, you can install ppa-purge:
***
sudo apt-get install ppa-purge
***
And then remove the PPA, downgrading gracefully packages it provided to packages provided by official repositories:
***
sudo ppa-purge ppa:whatever/ppa
***
Note that this will uninstall packages provided by the PPA, but not those provided by the official repositories. If you want to remove them, you should tell it to apt:
***
sudo apt-get purge package_name
***
Last but not least, you can also disable or remove PPAs from the "Software Sources" section in Ubuntu Settings with a few clicks of your mouse (no terminal needed).
3 years ago
While dpkg -i indeed installs the package, it doesn't do any automatic dependency resolution, meanwhile there are two other alternatives, using gdebi, or the apt-get tool. To use the later just use:
***
sudo apt-get install /path/to/package.deb
***
Even if you are on the directory with the package you need to give a path using ./ at the start:
***
sudo apt-get install ./package.deb
***
3 years ago
Whenever you receive from the command apt-get upgrade the message
***
The following packages have been kept back:
***
then to upgrade one or all of the kept-back packages, without doing a distribution upgrade (this is what dist-upgrade does, if I remember correctly) is to issue the command:
***
apt-get install
***
this will resolve the kept-back issues and will ask to install additional packages, etc. as was explained by other answers.
3 years ago
You can delete the lock file with the following command:
***
sudo rm /var/lib/apt/lists/lock
***
You may also need to delete the lock file in the cache directory
***
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
***
After that, try opening Synaptic again.
This should be used as last resort. If you use this carelessly you can end up with a broken system.
3 years ago
just redirect the output (AKA stdout) to a file:
***
SomeCommand > SomeFile.txt
***
Or if you want to append data:
***
SomeCommand >> SomeFile.txt
***
If you want stderr as well use this:
***
SomeCommand &> SomeFile.txt
***
or this to append:
***
SomeCommand &>> SomeFile.txt
***
if you want to have both stderr and output displayed on the console and in a file use this:
***
SomeCommand 2>&1 | tee SomeFile.txt
***
(If you want the output only, drop the 2 above)
3 years ago
copy the content of a folder /source to another existing folder /dest with the command
***
cp -a /source/. /dest/
***
The -a option is an improved recursive option, that preserve all file attributes, and also preserve symlinks.

The . at end of the source path is a specific cp syntax that allow to copy all files and folders, included hidden ones.
3 years ago
The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly. A useful mnemonic is "A for array and C for comma."

See MDN's documentation on apply and call.

Pseudo syntax:

theFunction.apply(valueForThis, arrayOfArgs)

theFunction.call(valueForThis, arg1, arg2, ...)

There is also, as of ES6, the possibility to spread the array for use with the call function, you can see the compatibilities here.

Sample code:
***
function theFunction(name, profession) {
console.log("My name is " + name + " and I am a " + profession +".");
}
theFunction("John", "fireman");
theFunction.apply(undefined, ["Susan", "school teacher"]);
theFunction.call(undefined, "Claude", "mathematician");
theFunction.call(undefined, ...["Matthew", "physicist"]); // used with the spread operator
***
3 years ago
The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly. A useful mnemonic is "A for array and C for comma."

See MDN's documentation on apply and call.

Pseudo syntax:

theFunction.apply(valueForThis, arrayOfArgs)

theFunction.call(valueForThis, arg1, arg2, ...)

There is also, as of ES6, the possibility to spread the array for use with the call function, you can see the compatibilities here.

Sample code:
***
function theFunction(name, profession) {
console.log("My name is " + name + " and I am a " + profession +".");
}
theFunction("John", "fireman");
theFunction.apply(undefined, ["Susan", "school teacher"]);
theFunction.call(undefined, "Claude", "mathematician");
theFunction.call(undefined, ...["Matthew", "physicist"]); // used with the spread operator
***
3 years ago