Shell Commands

Most commands operate like this: command -options arguments

pwd (print working directory)

cd (change directory).

    Absolute pathname: "cd /home/students" ;

    Relative pathname: "cd .." (parent directory) and "cd ./students" (currently working directory,  the "./" can be omitted)

    Shotcuts:

    "cd " to your home directory"

    "cd ~user_name" to the home directory of the specified user

    "cd - "  to the previous one

ls (list files and directories)

Examples of the ls command
Command Result
ls
List the files in the working directory

ls /bin
List the files in the /bin directory (or any other directory you care to specify)

ls -l
List the files in the working directory in long format

ls -l /etc /bin
List the files in the /bin directory and the /etc directory in long format

ls -a 
show all files include hiddend files(begig with ".")

ls -la ..
List all files (even ones with names beginning with a period character, which are normally hidden) in the parent of the working directory in long format

less (view text files)

Keyboard commands for the less program
Command Action

Page Up or b


Scroll back one page


Page Down or space


Scroll forward one page


G


Go to the end of the text file


1G


Go to the beginning of the text file


/characters


Search forward in the text file for an occurrence of the specified characters


n


Repeat the previous search


h


Display a complete list less commands and options


q


Quit

file (tell you what kind of file it is.

Reference: http://linuxcommand.org/lc3_lts0020.php

tell you what kind of file it is.

时间: 2024-10-13 12:22:33

Shell Commands的相关文章

mysql 使用 informatin_schema tables 创建 shell commands

SELECT CONCAT("mysqldump -uroot -p ", TABLE_SCHEMA, " ", TABLE_NAME, " >> ", TABLE_SCHEMA, ".bak.sql") FROM INFORMATION_SCHEMA WHERE TABLE_NAME LIKE 'Country%'; 还可以把生成的shell命令保存在文件里(但必须是本地文件夹,或者客户端所在的主机文件夹, 也或

ADB Shell Commands -- ADB命令大全

怎么使用命令: 1.解压ADB包到指定文件夹,内含文件有:adb.exe,AdbWinApi.dll,AdbWinUsbApi.dll : 2.打开 CMD(Win+R)进入到 ADB 路径下,开始执行ADB命令. ADB命令集合: ADB Debugging adb devices adb forward adb kill-server Wireless adb connect adb usb Package Manager adb install adb uninstall adb shel

some Linux shell commands

1. date: show current date and time. 2. cal: calendar. 3. df: to see the current amount of free space on your disk drives. 4. free: show the amount of the free memory(if using this command at Cygwin, crocps package should have been installed first).

echo shell commands as they are executed

http://stackoverflow.com/questions/2853803/in-a-shell-script-echo-shell-commands-as-they-are-executed set -x #echo on 或者 #!/bin/bash -x

run commands in linux shell using batch file

adb shell as root after device rooted once device rooted, we must perform "su" before we get root permission in adb shell,this is not convenient in some situations,so there have a method to get permission without perform "su". adb shel

2.Linux Shell函数

1.Shell搜索命令的顺序 当Shell执行命令时,并不是直接就在PATH路径中查找,而是按照固定的顺序依次寻找命令位置.搜索顺序如下. 1.别名.即使用alias commond="..."创建的命令. 2.关键字.如if,for. 3.函数. 4.内置命令.如cd,pwd等命令. 5.外部命令.脚本或可执行程序,这才在PATH路径中查找. 2.函数使用的规则 1.先定义,后使用. 2.函数在当前环境运行,共享调用他的脚本中的变量. 3.函数允许以位置参数的方式传递参数,位置参数是

java程序执行,调用shell命令和shell脚本

  坑呀!记得在start()之后, waitFor()之前把缓冲区读出来打log,否则是阻塞缓冲区,没有输出的 package com.jikexueyuancrm.util; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import

Shell 语法 if 、 case 、for 、 while、 until 、select 、repeat、子函数

if语法 : if [ expression ]    then   commandselif [ expression2 ]   then   commandselse   commandsfi case 语法: case string1 in   str1)    commands;;   str2)    commands;;   *)    commans;;esac 循环语句 for 语法:    for  var in list do commands done     在此形式时,

HDFS F ile System Shell Guide

Overview appendToFile cat checksum chgrp chmod chown copyFromLocal copyToLocal count cp createSnapshot deleteSnapshot df du dus expunge find get getfacl getfattr getmerge help ls lsr mkdir moveFromLocal moveToLocal mv put renameSnapshot rm rmdir rmr