1 / 14

Linux commands – part 3

Linux commands – part 3. CS 302. Sort. Sort the lines of text files . $ sort fileName by default it will sort in normal order(0-9 A-Z ). Options -r Reverse normal order(reverse alphabetical Z-A 9-0). -n Sort in the following order ( A-Z 0-9 )

Download Presentation

Linux commands – part 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.


Presentation Transcript

  1. Linux commands – part 3 CS 302

  2. Sort • Sort the lines of text files. $ sort fileName • by default it will sort in normal order(0-9 A-Z ). • Options -rReverse normal order(reverse alphabetical Z-A 9-0). -nSort in the following order (A-Z 0-9) -nrSort in reverse of –n (9-0 Z-A) • Note that this command does not sort the actual file, it just displays the sorted output on your terminal.

  3. Count words • Short for word count, • wcdisplays a count of lines, words, and characters in a file.

  4. Date Display date. • Show current date & time $ date • The following command takes an inputdate only string, and displays the output in date format $date --date=“2001-3-15”

  5. Date • Setdate. $ date –s “date to be changed”

  6. Calendar • Prints out a formatted calendar of the current month, or a specified month, or a specified whole year. • $ cal • $cal 2001

  7. History • Print the history of used commands. $ history • This command will display the last n commands in your history: (n is a number) $ history n

  8. Sequential commands • To run a sequence of commands type several commands on the same command line and separating them with semicolons(;) • $pwd ; ls

  9. Alias • Alias command allows a user to create simple names for any command (even sequential one) then use them in the same way that ordinary commands are used. • To create a simple name for pwd command : • alias p="pwd“ • To create a simple name for Is –al command: • alias ls="ls -al“ • To create a simple name for a sequential command pwd; ls : • alias pl='pwd; ls • To remove the simple name , use the command unailias • unalias pl='pwd; ls

  10. Free disk • Report how much free disk space is available for each mount you have •  To list all file systems and their used and available space • $ df • To displays the free disk information in a readable format: • $ df -h

  11. Logout • This command allows user to logout from the system. • % logout

  12. Process management • What is a UNIX Process? • A process in Linux is an executing command or program. • The process is what actually performs the work of the command or program. • A process is created every time you run a command or program from the command line. • For example, when you execute a simple command like ls, a single process is created .

  13. Process management • To get a report about the current processes • % ps • The above command will list all current processes to you with these information:

  14. Process management • To kill one of these processes • $ kill -9 4460 (where 17525 is the PID).

More Related