Tips for using Linux operating system

  • The virtual machine only installs ssh and can only connect to other servers. After installing openssh server, you can use ssh to connect to other terminals
  • Remote file transfer

    • Copy from local to remote

      scp local_file remote_username@remote_ip:remote_folder 
      scp local_file remote_username@remote_ip:remote_file 
      scp local_file remote_ip:remote_folder 
      scp local_file remote_ip:remote_file
      # Application examples
      ➜  Desktop scp a.c lite@
      lite@'s password:

    The first and second specify the user name, and the password needs to be entered after the command is executed. The first only specifies the remote directory, and the file name remains unchanged. The second specifies the file name;

    No user name is specified in the 3rd and 4th. After the command is executed, the user name and password need to be entered. The 3rd only specifies the remote directory, and the file name remains unchanged. The 4th specifies the file name;

    • Copy from remote to local

      You only need to change the order of the last two parameters of the command copied from the local to the remote, as shown in the following example:

      ➜  Desktop scp lite@ pwd
      lite@'s password:
      • It should be noted that if you copy a folder, you need to add the parameter - r, such as scp -r xxxx
    • Change fonts for Ubuntu operating system

      • Some good fonts

        Fira code (for better programming effect and supporting conjoined)

        Source Code Pro

      • Installation method

        # First output the currently installed font and confirm that the fc command is available
        ➜  ~ fc-list
        /usr/share/fonts/truetype/tlwg/TlwgTypo-Bold.ttf: Tlwg Typo:style=Bold
        /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold /usr/share/fonts/truetype/fonts-kalapi/Kalapi.ttf: Kalapi:style=Regular        /usr/share/fonts/truetype/fonts-gujr-extra/Rekha.ttf: Rekha:style=Medium       /usr/share/fonts/truetype/tlwg/TlwgTypewriter-BoldOblique.ttf: Tlwg Typewriter:style=Bold Oblique

        Then put the with ttf suffix font file moved to ~ / local/share/fonts. If not, create this directory

        ➜  ~ cd ~/.local/share/fonts
        ➜  fonts ll
        total 3.8M
        -rw------- 1 lite lite 243K Jul 16  2019 FiraCode-Bold.ttf
        -rw------- 1 lite lite 219K Jul 16  2019 FiraCode-Light.ttf
        -rw------- 1 lite lite 215K Jul 16  2019 FiraCode-Medium.ttf
        -rw------- 1 lite lite 217K Jul 16  2019 FiraCode-Regular.ttf
        -rw------- 1 lite lite 216K Jul 16  2019 FiraCode-Retina.ttf
        -rwxrwxrwx 1 lite lite 171K Jul 18  2016 SourceCodePro-BlackIt.ttf
        -rwxrwxrwx 1 lite lite 207K Jul 18  2016 SourceCodePro-Black.ttf
        -rwxrwxrwx 1 lite lite 171K Jul 18  2016 SourceCodePro-BoldIt.ttf
        -rwxrwxrwx 1 lite lite 207K Jul 18  2016 SourceCodePro-Bold.ttf
        -rwxrwxrwx 1 lite lite 172K Jul 18  2016 SourceCodePro-ExtraLightIt.ttf
        -rwxrwxrwx 1 lite lite 209K Jul 18  2016 SourceCodePro-ExtraLight.ttf
        -rwxrwxrwx 1 lite lite 177K Jul 18  2016 SourceCodePro-It.ttf
        -rwxrwxrwx 1 lite lite 172K Jul 18  2016 SourceCodePro-LightIt.ttf
        -rwxrwxrwx 1 lite lite 209K Jul 18  2016 SourceCodePro-Light.ttf
        -rwxrwxrwx 1 lite lite 172K Jul 18  2016 SourceCodePro-MediumIt.ttf
        -rwxrwxrwx 1 lite lite 208K Jul 18  2016 SourceCodePro-Medium.ttf
        -rwxrwxrwx 1 lite lite 208K Jul 18  2016 SourceCodePro-Regular.ttf
        -rwxrwxrwx 1 lite lite 171K Jul 18  2016 SourceCodePro-SemiboldIt.ttf
        -rwxrwxrwx 1 lite lite 208K Jul 18  2016 SourceCodePro-Semibold.ttf

        Finally, execute FC cache to update the font cache file

        ➜  fonts fc-cache

        Finally, you can see the effect

    • Related links

  • File operation command


    • -a: This option is usually used when copying a directory. It retains links, file properties, and copies everything under the directory. Its function is equal to dpR parameter combination.
    • -d: Keep links when copying. The links mentioned here are equivalent to shortcuts in Windows system.
    • -f: Overwrite the existing target file without prompting.
    • -i: Contrary to the - f option, a prompt is given before overwriting the target file to ask the user to confirm whether to overwrite. When you answer "y", the target file will be overwritten.
    • -p: In addition to copying the contents of the file, the modification time and access rights are also copied to the new file.
    • -r: If the given source file is a directory file, all subdirectories and files under the directory will be copied at this time.
    • -l: Do not copy files, just generate linked files.

    See rookie tutorial link for details

  • If even entering a folder is rejected, it means you don't have x permission. You can't use ls command to enter the folder. It means you don't have r permission. All r+x get the whole
  • Creation method of Linux multi-level directory: mkdir -p
  • rsync -- another powerful cp command, which can ssh cp or selectively copy the entire folder
**Uninstall a more complete use apt-get Installed software**

To uninstall Python2.7 take as an example

1. uninstall python2.7

sudo apt-get remove python2.7

2. uninstall python2.7 And its dependence

sudo apt-get remove --auto-remove python2.7

3. eliminate python2.7 Some configuration files

sudo apt-get purge python2.7 
sudo apt-get purge --auto-remove python2.7

Keywords: Linux

Added by wowiz on Mon, 28 Feb 2022 04:47:39 +0200