Tag archives: Linux

RSS feed of Linux

Linux Vim commands Collection

Vim commands Collection

Command History

 To: and / beginning commands have history, you can type the first: or / and then press the down arrow to select a command history.

Start vim

Enter the following command in the command line window to

    [root@mylab]# vim

vim filename open vim or create a file named filename

    [root@mylab ...

Continue reading

Linux Redis 3.0.5 installation and configuration

Redis 3.0.5 on the Linux installation and configuration

1. Download the installation package

[root@mylab]# wget http://download.redis.io/releases/redis-3.0.5.tar.gz

2. Compilation and installation

[root@mylab]# yum install gcc tcl
[root@mylab]# tar -zxf redis-3.0.5.tar.gz
[root@mylab]# cd redis-3.0.5
[root@mylab ...

Continue reading

linux centos7 switch graphic mode and text mode

centos7 switch graphic mode and text mode

In the graphic mode using ctrl + alt + F2 to switch to a text mode.
text mode press ctrl + alt + F2 to switch back to the graphic mode.
Enter the command init 3 to switch to text mode.
Enter the command init 5 to switch to graphic mode.

If ...

Continue reading

linux IO redirection

linux IO redirection

The default output device: standard output, STDOUT, 1
Default input device: standard input, STDIN, 0
Standard error output: STDERR, 2

Linux I/O redirection:

>: Override Output
eg. [root@mylab]# ls /var > /tmp/var2.out
>>: Append output
set -C: already prohibits the use of file redirection coverage
Force overwrite output ...

Continue reading

linux bash shell command aliases Command substitution globbing

linux bash shell command aliases Command substitution globbing

1.bash shell command aliases:

##### alias CMDALIAS = 'COMMAND [options] [arguments]'
##### Shell aliases defined only valid in the current shell life cycle; effective range of only the current    shell process alias:
 eg. [root@levi ~]# alias cls=clear
Cancel command aliases:
[root@levi ~]#unalias CMDALIAS
the same alias command ...

Continue reading

linux help command Summary notes

Linux help command : help,--help,man,info

type command : View command type(Internal Command,External Command)
eg.:
[root@levi ~]# type -a cd 
cd is a shell builtin (Internal Command)

[root@levi ~]# type -a grep 
 grep is /bin/grep    ( External Command)
1.Internal Command (Help view)
help COMMAND
2.External Command (help view)
COMMAND --help
3 ...

Continue reading

linux Execute shell script exception bad interpreter: No such file or directory

linux sh script exception /bin/sh^M:bad interpreter: No such file or directory

reason : This is caused by a different system encoding formats.

resolve : 1.Conversion at windows

        Use UltraEdit or EditPlus

        UltraEdit: File-->Conversions-->DOS-->UNIX

        EditPlus : Edit-->EOL Conversions-->Convert to UNIX Format


        2.Conversion with vi

        >vi filename

        :set ff or :set fileformat

        You can see ...

Continue reading

linux c library function to read binary file code

linux c library function to read binary file code

struct person
{
    int id;
    char name[20];
    int age;
    int sex;
    char tel[20];
};


int main(int arg, char *args[])
{
    FILE *p = fopen(args[1], "w");
    if (p == NULL)
    {
        printf("error is %s\n", strerror(errno));
    } else
    {
        printf("success\n");
        struct person man;
        memset(&man, 0 ...

Continue reading