more command
You can use more command instead cat command to view the contents of a file. For example:
more /etc/network/interfaces
You can now see catalog of your network interfaces file on the terminal window.Get the calender
The cal command displays a text based calender on your terminal. But your Raspberry Pi has no real time clock you should connect to Internet for accessing correct date.
What is my Disk Usage?
One advantage that Windows and Macintosh systems have over Unix is that they make it easy to find out how much disk space you’re using and how much remains available. On Windows, each partition of your hard disk says itself about disk space used.
Like a close-mouthed police informant, Unix never volunteers any information, so you need to learn two new commands. The du (disk usage) command is used to find out how
much disk space is used; the df (disk free) command is used to find out how much space is available.
du
du -h /opt or
du -hs /opt/* or
du -hs /opt/* or
Shows your disk usage. Here our disk SD Card. The du command find out how much space a directory tree uses.
Options: (-h) human readable form, (-s) summary, (-c) total.
du -hc *.mp4
While the command shown above finds the total size of the mp4 format files in the current directory.
df
df -h
Display available system disk space in (-h) human-readable form.
echo
The echo command simply echoes a string, output of a command, or a value to the standard output. Here is an example:
echo 'how are you?'
This command gives output how are you. That is it is an echo of whatever we are typed in single quotes.
We can use I/O redirection for store output of this commands as text files. This is the only advantage of this echo command.
uptime
This command uptime returns how long the system has been running.
Which Linux Distribution you are using?
more /etc/issue returns the Linux distribution you are using. Use cat instead more and observe the result.
Which is your currently using shell?
ps -p $$ returns the shell you are currently using (e.g., bash).
How can I find out executing processes and programs?
The top command lists all of the processes and programs executing. Press Ctrl+C to close the view.
Shutting down and Reboot
Physically disconnecting the power without allowing the Linux kernel
to unmount the micro-SD card can cause corruption of your file system.
But I disconneced it power without shutting down the Raspberry Pi. But it didn't corrupted my SD card. It may be due to I am lucky. But I only prefer you to shutdown using command or using shutdown option available on menu.
Improper shutdown can potentially corrupt the ext4 file system and/or lead to increased boot times due to file system checks. Here are some important points on shutting down, rebooting, and starting the RPi:
- Typing sudo shutdown -h now shuts down the board correctly. You can delay this by five minutes by typing sudo shutdown -h +5. The above commands are lengthy. From my personal experience sudo halt also does the same job.
- Typing sudo reboot will reset and reboot the board correctly.
If your project design is enclosed and you need an external soft power down, it is possible to wire an external button to an RPi GPIO input and write a shell script that runs on startup to poll the GPIO for an input. If that input occurs, /sbin/shutdown -h now can be called directly.
Is Raspberry Pi Comes with Hardware Reset?
You may see that Run header on your Raspberry Pi. The RPi does not have a power or a reset button, which means that if a system lock-up occurs you must unplug and replug the micro-USB power supply. This task can be awkward and can lead to physical damage of the RPi. (On older models, a common issue is that a large 220 μF capacitor is often used for physical leverage when unplugging the USB power input and it tends to fall off !)
The run headers are shown below:
The Raspberry Pi Run header: Courtesy Adafruit |
PC Power reset button |
The find command helps you to find out your file in this condition. Consider your name of file is GPIO.txt. You can find out this file using following command:
find . -name "GPIO.txt"
Here (.) is used to begin the search from current directory. According relative path (./ ) or simply (.) represents your current directory. If you want to begin your search from one directory up from your working directory use(..) instead (.). If you want to start your search from root directory put (/) instead (.). If you begin search from root directory you can see that terminal verbosing that permission denied. So you want to use sudo to begin search from root as shown:
sudo find / -name "GPIO.txt"
If you want to get the path of all text files starting from root, you can use wildcard entry as follows:
sudo find / -name "*.txt"
If you only interested to search from your current working directory use this command instead above command:
find . -name "*.txt"
Comments
Post a Comment