Linux Commands Examples

A great documentation place for Linux commands

arch

print machine hardware name (same as uname -m)


see also : uname

Synopsis

arch [OPTION]...


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
!<arch>
0
source

Speedup a Video on linux

mencoder has a -speed option you can use, e.g. -speed 2 to double the speed. It's described in the man page. Example:

mencoder -speed 2 -o output.avi -ovc lavc input.avi
0
source

Open up firewall automatically to anybody who has successfully connected via SSH

You can put commands in ~/.bashrc, anything in there is executed each time a user logs in.

For your commands to only run when logging in via ssh (and not when logging in physically), you can test for the presence of the SSH_CONNECTION environment variable.

0
source

Can't access folders mounted by sshfs after sleep (or when connection lost)

I suffer the same problem in Ubuntu Linux. What I do after resume:

$ killall -9 sshfs

Then, umount

$ fusermount -u ~/far_projects

and mount again the remote filesystem.

$ sshfs -o idmap=user youruser@server:/projects ~/far_projects
0
source

What is the difference between i686 and x86_64?

ix86 is an indication of the processor instruction set by generation of processor. For example: Intel Pentium, Intel Core2Duo, AMD K6. ix86 has been around for many years, if you have a processor made after 2000, it probably at least has the i686 instruction set. The absence of other indicators hints that this would be the 32 bit version.

x86_64 is indicating use of 64 bit registers and address space. Only choose this if you have a 64 bit processor and you want to use the 64 bit version of the operating system.

The choice is yours. I believe all AMD Turion processors have 64 bit support. You just need to decide if you want the 64 bit version or the 32 bit version of Arch Linux.

0
source

What do the power management tools in Linux do? (acpi, pm-utils, etc...)

  • acpi is just a small program that displays basic ACPI information.

  • acpid is a daemon that handles ACPI events - mostly power button, lid, battery and related stuff. For example, if the power button was pressed, acpid runs shutdown. When AC power is connected, acpid can run the apropriate laptop-mode-tools command. If you use systemd, then it replaces most of acpid's functionality.

  • cpufreq (now obsolete) is a set of tools for adjusting CPU frequency. The core functionality is part of the kernel and accessible through /sys, and cpufreq commands are just for convenience, but some scripts may require them.

  • cpufreqd (with the d) is an user-space daemon that can be used as a replacement for the default kernel-space governors (powersave, ondemand, performance). It is not necessary – for most uses, the standard governors are enough.

  • cpupower is a replacement for cpufreq – it allows setting CPU frequency settings from command line.

  • laptop-mode-tools does various system adjustments whenever you plug or unplug AC power to your laptop – for example, disk spin-down times or switching cpufreq governors. It is triggered by acpid on AC events, and is inactive the rest of the time.

    (Note: Some of the settings in laptop-mode-tools may actually hurt performance and/or sanity; for example, it disables Ethernet autonegotiation, which IMHO is just silly.)

  • pm-utils handle the preparations of suspending to memory and/or disk (running pre-suspend hooks, choosing the best method). They are inactive the rest of the time.

    You used to need pm-utils to cleanly suspend the machine, but on modern machines, pm-utils does very little as it can just tell the kernel to suspend. If you use systemd, then it replaces pm-utils.

  • Additionally, pm-utils comes with a pm-powersave command that performs most of the same functions as laptop-mode-tools. pm-powersave is triggered by upower when you plug/unplug AC power, and performs various adjustments.

  • systemd-logind has functions for suspending/hibernating, and handles the most common ACPI events (lid switch, power button, etc.) It replaces acpid and pm-utils on most systems.

    (Unlike pm-utils, however, systemd-logind does not come with any pre-suspend hooks or other workarounds by default, and only uses the default kernel suspend method. It expects driver bugs to be fixed in the drivers.)

  • upower is an abstraction layer for desktop applications to various power parameters. Programs can use it to check battery status, adjust backlight, or suspend the system without having to care about the specific platform. upower also uses PolicyKit to allow various actions (suspend, etc) without giving away full root privileges. It relies on pm-utils and acpid. GNOME and Xfce require upower for their "power management" settings.

  • Xfce Power Manager controls such parameters as display poweroff time, CPU scaling, LCD brightness, ACPI events... (The function are similar to acpid and laptop-mode-tools, which both only have one system-wide configuration, while XfPM allows per-user settings.) XfPM only manages the policy, but relies on upower for the actual mechanisms. Also, XfPM sends out[citation needed] such notifications as "Low battery".

Note: I'm not entirely sure what is the relation between XfPM, acpid, laptop-mode-tools, and upower. It seems to me that XfPM replaces most of acpid/l-m-t functions, but not all of them.

0
source

Preinstalled Windows 8 and Linux UEFI dual boot on a laptop

It might be worth doing a cold shutdown (hit the power button) in Windows to see if you can boot afterwards, just as a test. Obviously you wouldn't want to do this on a regular basis, but it might be helpful to confirm that Windows is overwriting your revised ESP data. If it's actually damaging the filesystem on Windows shutdown, then this sounds like a Windows bug that should be reported to Microsoft. If it's just replacing the bootmgfw.efi file, then that's technically within Microsoft's purvue, so it's not really a bug.

More broadly speaking, though, have you tried using linux's efibootmgr program to register rEFInd with the EFI under its own name (say, EFI/refind on the ESP)? This is described in rEFInd's documentation, in the section on manual Linux installation. Alternatively, you could install using the install.sh script. Either method will require an EFI-mode boot to succeed, but you should be able to do this using a rEFInd CD or boot from an emergency disc in EFI mode.

If efibootmgr doesn't work, try using bcfg in an EFI shell program, as described on this Arch wiki page.

If these procedures don't work, try using efibootmgr or bcfg to remove the entry for bootmgfw.efi from the NVRAM and then install rEFInd as EFI/BOOT/bootx64.efi. In theory, the computer might then launch rEFInd, which should work normally and enable booting either OS. There are two potential gotchas, though: The firmware might favor EFI/Microsoft/boot/bootmgfw.efi over EFI/BOOT/bootx64.efi; and Windows might check its boot options and add its own boot loader back to the NVRAM when it boots. Still, this method is worth a try.

The EFI spec requires computers to honor their NVRAM settings (which are managed by efibootmgr in Linux, bcfg in an EFI shell, or similar programs), so if these utilities don't work, your firmware is broken, and you may want to consider returning the computer for another model. (Be sure to tell Sony why you returned the computer if you do so, though!) This type of problem is actually fairly common; I've got a Gigabyte board with a "Hybrid EFI" that keeps forgetting its NVRAM settings, for instance. At least with this board, though, it's possible to bypass the problem by naming my boot manager/loader of choice EFI/BOOT/bootx64.efi.

If you can't get it working and are unwilling or unable to replace the computer, I do have two other suggestions for workarounds:

  • You could keep a bootable CD or USB flash drive on hand with rEFInd on it, and use it when you want to boot Linux. This may require using a function key to tell the computer to boot from the removable media rather than from the hard disk whenever you boot, though.
  • You could wipe the partitions from the disk, repartition using MBR, and re-install both OSes in BIOS mode rather than in EFI mode. This will remove any EFI flakiness from the picture and enable you to use a BIOS-mode GRUB as your boot loader. This will probably require a retail copy of the Windows 8 installer, though; at least for Windows 7, the OEM copies were inflexible about the installation mode (BIOS vs. EFI). Alternatively, it may be possible to convert from an EFI-mode boot to a BIOS-mode boot without re-installing. The opposite switch is possible (I was going to post a link to a site where it's described, but this site won't let me post more than two links; sorry), and I seem to recall running across descriptions of doing an EFI-to-BIOS conversion somewhere, but I don't have a URL handy. A Google search may turn something up.

I stumbled across this page after posting my first answer, and it has another possible cause for at least part of your problem: Apparently Windows 8 uses a shutdown method that's more akin to a suspend-to-disk operation. The result is that mounted partitions can become corrupted if you shut down Windows and then boot Linux. Although the ESP isn't normally mounted in Windows 7, AFAIK, it could be that Windows 8 does things differently, or maybe the ESP is mounted in Windows 7 and just seems to be hidden. In any event, you can disable this feature of Windows 8 by typing the following command in an Administrator Command Prompt window:

powercfg /h off
0
source

Why do we have 3 types of X-selections in LINUX?

Historical partly. I'm not sure secondary is used for anything at all anymore.

"cliboard" is what is used by most ctrl+x/c/v, it is the clipboard you put things into on purpose

"primary" is what holds whatever text is currently selected, it is how X keeps track of what is selected and conveniently may be pasted by middle clicking (or, if you're awesome, clicking right and left buttons at the same time) or by shift+insert in xterm

0
source

Arch Linux: 'whatprovides' equivalent option for pacman

I believe pkgfile or pkgfile -s are what you're looking for. For further reference I will direct you to here. The link will show you what other commands you might need a translation for. I hope it helps.

0
source

Arch Linux - How do I downgrade my kernel?

If you haven't cleaned the older kernels yet, they should still be available in the grub menu. I had this problem as well, when I installed the new kernel, my driver failed to work as well. A simple fix is to put the default option on the grub menu to the right kernel.

If you are using grub 2, this would be the way to check what the default option is.

jeffrey@ubuntu-linux:~$ head /etc/default/grub

If you change this file, run 'update-grub' afterwards to update /boot/grub/grub.cfg.

GRUB_DEFAULT=0

GRUB_HIDDEN_TIMEOUT=0

GRUB_HIDDEN_TIMEOUT_QUIET=true

You can change the grub_default value very easily, 0 would indicate the first option, 2 should be a previously used kernel.

gksudo gedit /etc/default/grub

Change the value, save it and run

sudo update-grub

If you are using an older grub version

You should edit this file: /boot/grub/menu.lst

Do the same steps, but grub_default is just plain "default" in this file. Run the update-grub script, reboot and you're fine to go.

0
source

How do I get ssh to read the destination's `.bashrc`?

Does the .bash_profile (or .profile if .bash_profile does not exist) run . .bashrc or source .bashrc at some point? If not, then your .bashrc will not be used when logging in via ssh, as ssh always starts bash as a "login" shell, which never reads .bashrc by default.

0
source

How to install autokey in the home directory in linux?

One usual way is to:

  1. Download source http://code.google.com/p/autokey/downloads/list
  2. Extract it
  3. Run something similar to ./configure --prefix=$HOME && make && make install
0
source

From GRUB2, boot an ISO in an LVM2 logical volume

It can be done easily :-) This is an detailed example on my website.

Adapted to your problem you should change:

loopback loop (hd0,gpt2)$isofile

for /dev/sda2 to:

loopback loop (hd0,$(getPartType /dev/sda)2)$isofile
0
source

Why is yaourt looking in the wrong place (pacman works)?

Yaourt apparently uses the first entry in $PATH, so /usr/bin needs to be before /usr/local/bin there.

Changing this in /etc/profile solved the problem.

0
source

How to execute bash script without password?

First, listen to what @daviewales said and do this properly using the init system. It's as simple as:

systemctl enable dhcpcd@wlp4s0.service

Second, your sudoers modification doesn't work because you've added the wrong path there.

  • You added /home/eugene/dhcpcdstart.sh to sudoers...

  • ...but you're running sudo dhcpcd, i.e. sudo /usr/bin/dhcpcd.

description

Print machine architecture.

--help

display this help and exit

--version

output version information and exit

copyright

Copyright © 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

reporting bugs

Report arch bugs to bug-coreutils[:at:]gnu[:dot:]org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report arch translation bugs to <http://translationproject.org/team/>


see also

uname , uname

The full documentation for arch is maintained as a Texinfo manual. If the info and arch programs are properly installed at your site, the command

info coreutils 'arch invocation'

should give you access to the complete manual.


author

Written by David MacKenzie and Karel Zak.

How can this site be more helpful to YOU ?


give  feedback