Unix Beginner Command

  

Classification summarizes the use of some Linux/Unix commands

Communication:

ftp File Transfer Protocol

login Login to Unix

mailx read or send mail

rlogin login to remote Unix

talk write to other terminal

telnet connect to another system

Vacation auto-response mail

compare:

cmp compare two files byte by byte

comm compare entries in two sort files

diff progressive Compare two files

diff3 compare 3 files

dircmp compare directories

sdiff compare two files side by side

File Management:

~ represents the user home directory (yourhome directory) .. represents the parent directory. represents the current directory

cat connects multiple files or displays them Ctrl+D end input such as: cat list1 list2 > biglistWhatthis is doing is reading The contents of list1 and list2 in turn, then outputing the text to the file biglist

cd change the directory directly after typing cd without directory The path will be returned directly to the user's working directory (this is very important to find the working directory when the user is lost in the file directory tree)

chmod Change the access mode of the file

cp Copy the file for example: cp file1 file2 is the command which makes a copy of file1 in the current working directory and calls it file2

csplit separates the file at a specific location

file determines the type of a file

head shows the first few lines of the file

ln creates an alias for the file

ls list shows the file or directory when the user logs in to the system is /home/user_name, Where user_name is the username. Typing ls alone does not display files with . before, because files that start with . are hidden and very important files, and unless you are familiar with Unix, it is generally not recommended to modify them. Type ls –a to display all files (including files starting with .) ls -l

mkdir create a directory

more display files by screen

mv move Or rename a file or directory

pwd Output the working directory to output the full path of the current directory

rcp Copy files to a remote system

rm Delete files

rmdir delete directory

split divides multiple files evenly

tail displays the last lines of the file

wc counts lines, words, and characters of a file

Other:

banner Display ad words

bc Set calculator with arbitrary precision

cal Display calendar

calendar Check memo

clear Clear screen

man Get help information for a command

nice Reduce the priority of a job

nohup Save a running job after exiting the system< Br>

passwd Set system login password

script Generate a transcript of the login session

spell Report misspelled words

su Become a superuser

Print:

cancel Cancel Printer Request

lp Send to Printer

lpstat Get Printer Status

pr Format Printer Content and Page Number

Programming:

cb C language source code optimizer

cc C language compiler

cflow C language function flow chart

ctags C language function reference information (for vi )

ctrace C language debugger using function call trace

cxref C language cross-reference

lint C language program parser

ld loader< Br>

lex lexical analyzer

make executes commands in the specified order

od dumps input in different ways

strip removes from an object file Data

truss trace signals and system calls

yacc parser generator, can be used with the lex command

Search:

less Search text content such as : Type less liao.txt and then the command stays in the less command, then type /type what you want to find by pressing q to quit the less command

The extended version of the egrep grep command

fgrep based on the word Search for files

find Searches the system based on the file name

gerp searches for files based on text format

strings Searches for binary files according to text format

shell programming:

echo Repeat command line arguments in input

expr Perform arithmetic operations and compares

line Read a line of input information

printf Format and print command line arguments

sleep pause processing

test test a condition

store:

compress compress files to free up space

cpio copy archive files to disk or Copy

gunzip decompressed (.gz and .z format) files from disk (preferred command)

gzcat displays the contents of the compressed file (can be used with the zcat command)

gzip compressed files to free up space (preferred command)

tar tape archives can also extract .tar format files such as: tar –xvf units-1.74.tar

uncompress solutions Compressed file (.z format)

zcat shows the contents of the compressed file

System status:

at then run the command

chgrp modify the file where

chown Modifying the owner of a file

crontab Automating commands

date Displaying or setting the date

df Displaying free disk space

Du shows disk space usage

env shows environment variables

finger displays user information

kill terminates a running command

ps shows process
>

sty Set or display terminal device

who shows that the logged-in user seems to type whoami in cygwin to display the logged in user

Text Processing:

cut Select Displayed columns

ex vi line editor

fmt makes the length of each line of text roughly the same

join merges different lines into one database

New version of the nawk awk command (pattern matching language for text database files)

paste merging columns or changing the order of columns

sed non-interactive text editor

Sorting or merging files can also sort the input of the command line directly, for example by typing sort directly. Sort <list1 represents the input of the contents of the file list1 as a sort. Sort < list1 >list2 means to sort the contents of list1 as input, and then output to list2

tr convert (redefine) characters

uniq search for duplicate or unique in a file Lines

vi Visualized Text Editor

xargs Handles Multiple Parameters in Manageable Part

Compiler Source Code Forms Installation Package:

The simplest way To compile a packageis:

  • cd to the directory containing the package's source code.
  • Type ./configure to configure the package for your system.
  • Type make to compile the Package.
  • type, make make check to run any self-tests that come with the package.
  • Type make install to install the programs and any data files and documentation.

    Optionally, type make clean to remove the program binaries and object files from the source code directory

    Variables:

    General variables are divided into environment variables and shell variables, environment variables are generally uppercase, and shell variables are generally lowercase.

    For example: % echo $OSTYPE will return the operating system type

    More examples of environment variablesare
    USER (your login name)HOME (the path name of your home directory)HOST (the Name of the computer you are using) ARCH (the architecture of the computers processor) DISPLAY (the name of the computer screen to display X windows) PRINTER (the default printer to send print jobs) PATH (the directories the shell should search to find a command)

    To show all values ​​of these variables, type

    % printenv |  Less will display the values ​​of all environment variables

    shell variables:

    More examples of shell variables are
    cwd (your current working directory)home (the path name of your home directory)path (the directories the shell should search to find a command)prompt (the text string used to prompt for interactive commands shell your login shell)

    To show all values ​​of these variables,type

    % set |  Less

  • Copyright © Windows knowledge All Rights Reserved