Linux Skills

Linux
Skills

*/-->

Linux Skills

Table of Contents

  • 1. How to use ramdisk in Ubuntu and Fedora?

  • 2. How to enable ssh server in Ubuntu?

  • 3. How to disable CPU in Linux?

  • 4. How to disable SELinux in Linux?

  • 5. How to deal with the errors in MP3 files in Rythmbox
    under Ubuntu?

  • 6. How to accelerate the ssh connection?

  • 7. When something goes wrong in ubuntu ?

  • 8. How to umount a filesystem even when it is
    busy?

  • 9. How to sync files without copying the originals when
    using Cloud Storage?

  • 10. How to rename multiple files at a time?

  • 11. What is the most amazing ssh option you have
    encountered?

  • 12. When Ubuntu Xsession goes wrong….

In this post, I will record the daily usage of linux, as well as the ways to
resolve the common problems.

1 How to use ramdisk in
Ubuntu and Fedora?

In Fedora, the ramdisk is disabled by default, that is, it is compiled into
the kernel, but as a module, which will be loaded into the kernel when actually
used. So, it is necessary to compile the kernel manually to select the ramdisk
as the built-in modules.

In Ubuntu, the ramdisk support is enabled by default, so the steps are easier
compared to Fedora.

Using the following commands to list the ramdisk:



ls /dev/ram*

The output will be like:





/dev/ram0 /dev/ram10 /dev/ram12 /dev/ram14 /dev/ram2
/dev/ram4 /dev/ram6 /dev/ram8
/dev/ram1 /dev/ram11 /dev/ram13 /dev/ram15 /dev/ram3
/dev/ram5 /dev/ram7 /dev/ram9

Format the ramdisk as an ext4fs:



mkfs.ext4 /dev/ram1

Then mount it:



sudo mount /dev/ram1 /mnt

2 How to enable ssh server
in Ubuntu?

By default, Ubuntu doesn‘t install the ssh server, so the following command
will fail:





ssh localhost
ssh: connect to host localhost port 22: Connection
refused

Using the following command to install the ssh-server:



sudo apt-get install openssh-server

Then all things will go well.

3 How to disable CPU in
Linux?

It is easy to do with real root user:




echo 0 > /sys/devices/system/cpu/cpuX/online

The CPU status can be checked by:



cat /proc/cpuinfo

To re-enable the CPU:




echo 1 > /sys/devices/system/cpu/cpuX/online

4 How to disable SELinux in
Linux?

The SELinux has some negative effect on the self-defined filesystem, so it is
necessary to disable it, using the following command:




sestatus \\

will list the status of the SELinux,



















SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28

To change the status of SELinux, modify the configure file in:




/etc/selinux/config \\

5 How to deal with the
errors in MP3 files in Rythmbox under Ubuntu?

The easiest way is as follows:



sudo gedit /etc/profile

Add the following two lines to the end of the file:





export PATH=$PATH
GST_ID3_TAG_ENCODING=GBK:UTF-8:GB18030
export PATH=$PATH
GST_ID3V2_TAG_ENCODING=GBK:UTF-8:GB18030

This enables the Chinese characters to be recoginized by the system.

6 How to accelerate the ssh
connection?

I am working on a project which has something to do with a remote server, and
I have to ssh to that server, but the server is Fedora and my os is Ubuntu, and
it turns out it takes a long time to resove the host/server IP, the solution to
this problem is:




ssh -o GSSAPIAuthentication=no [email protected]

7 When something goes wrong
in ubuntu ?

Afer a failed attempt to upgrade the Ubuntu13.10 to Ubuntu 14.04, the system
shows a popup window everytime the system boots, the title of the window is
"System Program Problem Detected". The following method can be used to solve
the problem:



sudo rm /var/crush/*

This command will delete the crushed software of the system so that the
reporting utility won‘t work, thus eliminating the annoying message.

8 How to umount a
filesystem even when it is busy?

Recently, a project requires frequently mounting and testing a filesystem,
and it is very likely that the newly-mounted filesystem will crash for all
kinds of reasons, and after the accident, it is no longer possible to umount
the filesystem in a normal way. The error message from the OS is as follows:

With the -l option of umount, the result can be seen as follows:

9 How to sync files without
copying the originals when using Cloud Storage?

When using CloudDrive, it is likely that the software may only allow you to
synchronize the files or folders under a specific folder, if you have many
other directories to synchronize, you have to copy files, but there is a simple
way to achieve the same goal without copying files—the symbolic link.
In
Linux,the following command can be used to create a symbolic link to another
directory:



ln -s target-folder link-name

\\

In windows, use the following command:



mklink /J link-name target-folder

10 How to rename multiple
files at a time?

  1. Add extention to all the files in a directory: \



    for f in *;do mv "$f" "$f.png";done

  2. Rename: \



    rename ‘s/old-name/new-name/‘ files

11 What is the most
amazing ssh option you have encountered?

The first useful option of ssh is the GSSAPIAuthentication=no, which
accelerates the connection startup time. Another useful option is the X11
forwarding, with the -X option, you can use the X11 application from the
localhost.(Especially for emacs).

12 When Ubuntu Xsession
goes wrong….

The problem I encountered is like this:
When I want to logout the
xsession of ubuntu, it fails to close all the running application and return
back to the login screen, so I start a terminal by ALT+CRTL+F1, from which I did
a reboot. After the system booted, I typed my password to my account, but it
returned back to the login session again, and the process continued.

There was some error messages in ~/.xsession-error file, and the mode bits of
~/.xauthority file has changed to root only, so the correct way to deal with
the problem is use the following command:



sudo chmod +x 777 .Xauthority

Author: wujing

Created: 2014-04-29 二 19:06

Emacs 24.3.1
(Org mode 8.2.6)

Validate

Linux Skills,码迷,mamicode.com

时间: 07-22

Linux Skills的相关文章

The Essential Skills to Becoming a Master Hacker

2 Networking Skills You need to understand the basics of networking, such as the following. DHCP NAT Subnetting IPv4 IPv6 Public v Private IP DNS Routers and switches VLANs OSI model MAC addressing ARP As we are often exploiting these technologies, t

linux重要命令

echo echo命令用于在终端显示字符串或输出变量提取后的值,格式为:"echo [字符串 | $变量]". 将指定字符串输出到终端屏幕: [[email protected] ~]# echo Linuxprobe.Com Linuxprobe.Com 使用$变量的方式提取变量值并输出到屏幕: [[email protected] ~]# echo $SHELL /bin/bash date命令用于显示及设置系统的时间或日期,格式为:"date [选项] [+指定的格式]

delphi 开发者 linux 实务(转)

Linux Essentials for Delphi Developers There is currently no way using Delphi to target Linux. Long ago there was a thing called Kylix that worked on one version of RedHat Linux, barely, back in the 1990s. But in the Community road-map, targeting a f

03、新手必须掌握的Linux命令

Ⅰ. 常用系统工作命令 1. echo 命令 echo命令用于在终端输出字符串货变量提取后的值,格式为"echo [字符串 | $变量]" 例:把指定字符串"LinxuHat"输出到终端屏幕的命令为: [[email protected] Desktop]# echo LinuxHat 该命令会在终端屏幕上显示如下信息: LinuxHat 使用$变量的方式提取变量SHELL的值,并将其输出到屏幕上: [[email protected] Desktop]# echo

用户登录日志与命令执行记录

编辑这个文件,用来设置登录前告警信息[[email protected] etc]# cat /etc/login.warn !!!! Welcome to KernelTalks test server !!!!This server is meant for testing Linux commands and tools. If you arenot associated with kerneltalks.com and not authorized please dis-connecti

linuxprobe

linuxprobe yum仓库 yum repolist all 列出所有仓库 yum list all 列出仓库中所有软件包 yum info 软件包名称 查看软件包信息 yum install 软件包名称 安装软件包 yum reinstall 软件包名称 重新安装软件包 yum update 软件包名称 升级软件包 yum remove 软件包名称 移除软件包 yum clean all 清除所有仓库缓存 yum check-update 检查可更新的软件包 yum grouplist

picoCTF2018记录

近期准备参加CTF 一头雾水 开始练练手 https://2018game.picoctf.com/  这个网站挺适合新手的(据说面向高中生?? 惭愧惭愧) 前面几个比较简单 就从 Resources - Points: 50 - (Solves: 26288)这个开始 Resources - Points: 50 - (Solves: 26288) Solve: We put together a bunch of resources to help you out on our websit

Enabling Active Directory Authentication for VMWare Server running on Linux《转载》

Enabling Active Directory Authentication for VMWare Server running on Linux Version 0.2 - Adam Breidenbaugh - 2007-06-29 Purpose The purpose of this guide is as follows: Document the steps necessary to enable Active Directory Authentication on a Linu

Requirement-Driven Linux Shell Programming

*/--> Requirement-Driven Linux Shell Programming Table of Contents 1. Where can I find the basic Material about Linux Shell Programming? 2. How to time a function/program(Get the execution time of a program)? 3. How to pass parameters to a function?