Ubuntu Command Memo

Source: Internet
Author: User
Tags anonymous parent directory
First, modify the file by default open way 1.1 Related configuration files

The configuration files that are related to Ubuntu and the way files are opened include:

Global configuration file
/etc/gnome/defaults.list
/usr/share/applications/mimeinfo.cache
Personal configuration
~/.local/share/applications/mimeapps.list
~/.local/share/applications/mimeinfo.cache

If the two are inconsistent, personal configuration priority 1.2 modifies the default open mode

This can be done by modifying

/etc/gnome/defaults.list

or modify

~/.local/share/applications/mimeapps.list file to complete

For example, by modifying the/etc/gnome/defaults.list file, the default opening of the PDF file is modified to Adobe Reader:

Application/pdf=adobereader.desktop;evince.desktop

The contents of these files are relatively simple, and they are no longer listed

Of course, you can also right-click on the file, and then select Properties to modify. second, software management

Apt-cache Search Package Package
Apt-cache Show package get information about the package, such as description, size, version, etc.
sudo apt-get install package installation package
sudo apt-get Install package--Reinstall reinstall package
sudo apt-get-f Install repair installation
sudo apt-get Remove Package Delete Package
sudo apt-get Remove Package--purge delete packages, including deleting profiles, etc.
sudo apt-get update source
sudo apt-get upgrade update installed packages
sudo apt-get Dist-upgrade upgrade system
sudo apt-get dselect-upgrade use Dselect upgrade
Apt-cache depends package understand usage dependencies
Apt-cache Rdepends package is to see which packages are dependent on the package
sudo apt-get BUILD-DEP Package Installation-related compilation environment
Apt-get Source package Download the source code for this package
sudo apt-get clean && sudo apt-get autoclean cleanup unwanted packages
sudo apt-get check checks for corrupted dependencies

If you want to modify the software source, you can first open the Software center, and then open the Edit menu, then select the software source can be selected to modify three, install, uninstall ISO 3.1 installation

sudo mount-t iso9660-o loop xxx.iso/media/yourdir
Command parameter explanation:
sudo has root privileges in Ubuntu (terminal only)
Mount mount command (load file system and drive) (requires root permissions)
T iso9660-t= file system type <iso9660=cd-rom CD standard file System >
The-o loop-o= option <loop used to suspend a file or mirror as a partition system >
Xxx.iso the path of the mirrored file that needs to be mounted
/media/yourdir the directory to be mounted
3.2 Uninstall

sudo umount-t iso9660/media/yourdir
four, format the disk

If you want to format the disk in FAT or FAT32 format, execute the command:
sudo mkfs.vfat-f 32/dev/sdb1 you can format the U disk into FAT32 format.
If you want to format the specified disk as NTFS, you need to first install the NTFS tool by executing the command:

sudo apt-get install Ntfsprogs

And then execute the command:

sudo mkfs.ntfs/dev/sda1

If you want to format in Linux ext format, you can perform
sudo mkfs.ext4/dev/sda1 # formatted as a EXT4 partition
sudo mkfs.ext3/dev/sda1 # formatted as a EXT3 partition
sudo mkfs.ext2/dev/sda1 #格式化为ext2分区
It should be noted that for the partition to be formatted, you must first uninstall the Umount
v. Install and configure a TFTP server

5.1. Install TFTP server side and client (if already installed, can ignore this step) sudo apt-get install tftpd-hpa; Install TFTP server
sudo apt-get install TFTP-HPA install TFTP client
5.2. Install xinetd (if already installed, ignore this step) sudo apt-get install xinetd
5.3. Create your own Tftpboot directory, as a directory of servers

(I was built in the root directory)
sudo mkdir/tftpboot
Modify Permissions:
sudo chmod 777/tftpboot
5.4. Configure the TFTP server: The related configuration file is/ETC/DEFAULT/TFTPD-HPA, which reads:

#/ETC/DEFAULT/TFTPD-HPA


tftp_username= "TFTP"   //tftp's name
tftp_directory= "/tftpboot"  //tftp Server directory
tftp_address= "0.0.0.0:69"
Tftp_options= "--secure"

5.5. Restart xinetd service sudo/etc/init.d/xinetd restart
5.6. Restart TFTPD Service
SUDO/ETC/INIT.D/TFTPD-HPA restart
So the TFTP server is installed and configured to complete

vi. Installing and Configuring Server for NFS 6.1 Installing Ubuntu NFS

sudo apt-get install Nfs-kernel-server

6.2 Configuring Server for NFS

NFS's configuration file is/etc/exports, and its contents are:

#/etc/exports:the access Control list for filesystems which May is exported
# to		NFS clients.  Exports (5).
#
# Example for NFSv2 and NFSv3:
#/srv/homes       hostname1 (rw,sync,no_subtree_check) hostname2 (ro,sync,no_ Subtree_check)
#
Example for NFSv4:
#/srv/nfs4        gss/krb5i (rw,sync,fsid=0,crossmnt,no_subtree _check)
#/srv/nfs4/homes  gss/krb5i (Rw,sync,no_subtree_check)
#
/home/rover/rootfs * (rw,sync , No_root_squash)
Where:/home/rover/rootfs is the directory to be shared, RW is a read-write access, sync is data synchronization write memory and hard drive, No_root_squash is the Ubuntu NFS client sharing directory user permissions, if the client is using root, Then the client has root permissions for the shared directory.
Other commonly used parameters for Ubuntu NFS are:
RO read-only access to RW read-write access sync all data is written to share on request Async NFS can respond to requests before data is written to secure NFS sends insecure NFS through a secure TCP/IP port under 1024 wdelay if Multiple users to write to the NFS directory, the group write (default) No_wdelay If multiple users are writing to the NFS directory, write now and do not need this setting when using Async. Hide does not share subdirectories in the NFS shared directory No_hide shared NFS directory Subtree_check if you share subdirectories such as/usr/bin, Force NFS to check the permissions of the parent directory (default) No_subtree_check is relative to the above, Do not check the parent directory permissions all_squash the UID and GID of shared files map anonymous users anonymous, suitable for public directories. No_all_squash preserves UID and GID for shared files (default) Root_squash all requests for root users are mapped to the same permissions as the anonymous user (default) no_root_squas root has full administrative access to roots Anonuid=xxx Specify the UID of anonymous users in server/etc/passwd files for NFS anongid=xxx Specify the GID for anonymous users in server/etc/passwd files for NFS 6.3 Restart ServiceSudo/etc/init.d/portmap restart
Sudo/etc/init.d/nfs-kernel-server restart
You can then determine if the server was successfully opened by looking at the network port status

sudo netstat-tlunp

If monitoring is found for Port 111 and Port 2049, the server is turned on successfully.
The commands for viewing RPC-related information are as follows:
sudo rpcinfo-p localhost
or view file/etc/rpc
Seven, git common commands

Git annotate patches/pam-1.1.1-cve-2010-3853.patch View information for a patch
Git show submit number to view the submitted information
git reset--hard head~
Git log: You can view log records
git log--oneline file view git records for files
Git blame: View submit records for each row in the file
Git show commit: view changes to a commit
git reset commit: Reset to a Commit
git am 0001-pam-correctly-count-leading-whitespace-wr-1-0-secure.patch play patch

Git reflog View recently executed commands that can be used to reset
git revert e7df69c09251c3114e66a727b903449c7fb10112 Discard modifications
Eight, DTC tool

The DTC tool can be a useful tool to generate DTS based on DTB, or to generate DTB from DTS. How to use:

Dtc-i dtb-o DTS x.dtb-o x.dts//dtb into DTS
Dtc-i dts-o DtB x.dts-o x.dtb//dts converted into DTB
ix. making the ext2 format Rootfs

DD If=/dev/zero of=image.ext2 bs=1k count=1000000
Losetup/dev/loop0 image.ext2
sudo losetup/dev/loop0 image.ext2
sudo mke2fs-c/dev/loop0 1000000
sudo mount-t ext2/dev/loop0/mnt/tst/
Copy the whole file system to/mnt/tst
sudo umount/mnt/tst
sudo losetup-d/dev/loop0
Gzip the IMAGE.EXT2
Using Mkimage to add U-boot header
"Mkimage-a ppc-t ramdisk-c gzip-d image.ext2.gz image.ext2.gz.uboot"

If you already have a file system in the ext2 format, just modify its contents, you can ignore the DD command and the MKE2FS command, so that you can modify its content 10, Linux get the file name as long as you losetup it before you mount it.

File= "Thisfile.txt" echo "FileName: ${file%.*}" echo "Extension: ${file##*.}" output: Filename:thisfile extension:txt Path string Process DirName ${fullpath} to get the directory. BaseName ${fullpath} gets the filename. BaseName ${fullpath} ${ext} gets the filename and removes the specified extension.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.