Tin học Việt

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Tin học Việt

A place for learning and sharing knowledge

Latest topics

» [Đề thi] Đề thi HSG cấp thành phố lớp 12 đợt 1 môn Tin các năm
by camchung Sun Jul 26, 2015 10:49 am

» [Bài tập] Các bài tập quy hoạch động cơ bản
by popperdk Tue Apr 28, 2015 2:17 am

» [Unix/Linux] Lecture 2 - File Transfer and Working with Commands
by Admin Tue Apr 07, 2015 9:35 pm

» [Unix/Linux] Lecture 1 - Basic Command
by Admin Tue Apr 07, 2015 8:44 pm

» [Unix/Linux] Introduction To Unix/Linux
by Admin Tue Apr 07, 2015 8:17 pm

» [Thuật toán] Loang trên ma trận
by zoutsec Sat Feb 28, 2015 4:26 pm

» Thảo luận về stack!
by ganar27 Sat Jun 14, 2014 4:21 pm

» [Bài tập] Bài tập về đường đi ngắn nhất
by sonlv1112 Fri Feb 07, 2014 9:37 pm

» [Game học hóa] Căn nhà phù thủy
by Admin Sun Jan 26, 2014 8:32 pm

» [Game] Căn nhà phù thủy
by Admin Sun Jan 26, 2014 8:31 pm


    [Unix/Linux] Lecture 2 - File Transfer and Working with Commands

    avatar
    Admin
    Admin
    Admin


    Posts : 48
    Golds : 2147483646
    Liked : 18
    Ngày tham gia : 2011-08-25
    Tuổi : 27
    Đến từ : Ho Chi Minh City

    [Unix/Linux] Lecture 2 - File Transfer and Working with Commands Empty [Unix/Linux] Lecture 2 - File Transfer and Working with Commands

    Post by Admin Tue Apr 07, 2015 9:35 pm

    Lecture 2 - File Transfer and Working with Commands


    I. File Transfer


    One easy way to create a file is using touch
    Some common options:
  • Change access time: -a
  • Change modification time: -m
  • Change date: -d

    For example:
    We want to modify time create of a file we do the following steps.
  • We create a file name New - touch New
  • We create a file name Old with date 01/01/1980 at 12:00 - touch -t 8001011200 Old (2 first digits is the year, next 4 digits is the date, last 4 digits is the time).
  • We set the modification time to New file by - touch -r old new

    *Working with file contents*
    clear (Ctrl + L): clear screen.
    cat: display contents of a file. Can also use to create text files by using cat > filename. You can choose an end marker for cat with << This construction is called a here directive and will end the cat command. And we can also use cat to copy contents of one file to another file cat file1 > file2
    tac: display contents from bottom to top of a file.
    less: writes the contents of a file onto the screen a page at a time. Press [space-bar] if you want to see another page, type [q] if you want to quit.
    more: After each page, asks the user to hit a key to continue. Can also jump to the first occurrence of a keyword (/ command).
    head -n: The command head writes the first n lines of a file to the screen.
    tail -n: The command head writes the last n lines of a file to the screen.
    wc: Word Count.

    • Current date/time is Tue May 07, 2024 1:43 am